From dc83afb4de943580b059430c8dede6750b1d7d33 Mon Sep 17 00:00:00 2001 From: Chris Rankin Date: Mon, 11 Mar 2019 16:48:35 +0000 Subject: [PATCH] CORDA-2672: Tidy up CorDapp deployments in samples. (#4815) * CORDA-2672: Tidy up CorDapp deployments in samples. * CORDA-2672: Refactor Attachment Demo. * Remove Bank of Corda from Trader Demo. * Configure SLF4J simple loggers, fix comments and documentation. --- docs/source/cordapp-build-systems.rst | 24 ++++--- docs/source/tutorial-attachments.rst | 4 +- samples/attachment-demo/build.gradle | 60 +++++++++++++++-- .../attachmentdemo/AttachmentDemoTest.kt | 2 - .../corda/attachmentdemo}/AttachmentDemo.kt | 60 +---------------- .../src/main/resources/bank-of-london-cp.jar | Bin .../main/resources/simplelogger.properties | 3 + .../attachment-demo/workflows/build.gradle | 24 +------ .../workflows/AttachmentDemoFlow.kt | 57 ++++++++++++++++ samples/cordapp-configuration/build.gradle | 2 +- .../src/main/resources/log4j2.xml | 8 ++- .../workflows/build.gradle | 2 - .../corda/configsample/GetStringConfigFlow.kt | 6 -- .../workflows/src/main/resources/log4j2.xml | 13 ---- samples/irs-demo/cordapp/build.gradle | 12 +++- .../main/resources/simplelogger.properties | 3 + samples/network-verifier/build.gradle | 19 +++++- .../main/resources/simplelogger.properties | 3 + samples/notary-demo/build.gradle | 22 ++++-- .../net/corda/notarydemo/client}/Notarise.kt | 2 +- .../main/resources/simplelogger.properties | 3 + samples/notary-demo/workflows/build.gradle | 6 +- samples/simm-valuation-demo/build.gradle | 5 ++ .../contracts-states/build.gradle | 2 +- .../net/corda/vega/SimmValuationTest.kt | 8 --- .../src/main/resources/log4j2.xml | 4 +- samples/trader-demo/build.gradle | 63 +++++++++++++++--- .../net/corda/traderdemo/TraderDemoTest.kt | 17 +++-- .../kotlin/net/corda/traderdemo/TraderDemo.kt | 0 .../corda/traderdemo/TraderDemoClientApi.kt | 0 .../src/main/resources/bank-of-london-cp.jar | Bin .../main/resources/simplelogger.properties | 3 + .../trader-demo/workflows-trader/build.gradle | 35 ++-------- .../corda/traderdemo/flow/LoggingBuyerFlow.kt | 1 - .../{ => flow}/TransactionGraphSearch.kt | 2 +- .../{ => flow}/TransactionGraphSearchTests.kt | 2 +- .../src/test/resources/log4j2-test.xml | 17 +++++ 37 files changed, 296 insertions(+), 198 deletions(-) rename samples/attachment-demo/{workflows => }/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt (95%) rename samples/attachment-demo/{workflows/src/main/kotlin/net/corda/attachmentdemo/workflows => src/main/kotlin/net/corda/attachmentdemo}/AttachmentDemo.kt (70%) rename samples/attachment-demo/{workflows => }/src/main/resources/bank-of-london-cp.jar (100%) create mode 100644 samples/attachment-demo/src/main/resources/simplelogger.properties create mode 100644 samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemoFlow.kt rename samples/{simm-valuation-demo/flows => cordapp-configuration}/src/main/resources/log4j2.xml (89%) delete mode 100644 samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml create mode 100644 samples/irs-demo/cordapp/src/main/resources/simplelogger.properties create mode 100644 samples/network-verifier/src/main/resources/simplelogger.properties rename samples/notary-demo/{workflows/src/main/kotlin/net/corda/notarydemo => src/main/kotlin/net/corda/notarydemo/client}/Notarise.kt (98%) create mode 100644 samples/notary-demo/src/main/resources/simplelogger.properties rename samples/trader-demo/{workflows-trader => }/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt (90%) rename samples/trader-demo/{workflows-trader => }/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt (100%) rename samples/trader-demo/{workflows-trader => }/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt (100%) rename samples/trader-demo/{workflows-trader => }/src/main/resources/bank-of-london-cp.jar (100%) create mode 100644 samples/trader-demo/src/main/resources/simplelogger.properties rename samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/{ => flow}/TransactionGraphSearch.kt (99%) rename samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/{ => flow}/TransactionGraphSearchTests.kt (99%) create mode 100644 samples/trader-demo/workflows-trader/src/test/resources/log4j2-test.xml diff --git a/docs/source/cordapp-build-systems.rst b/docs/source/cordapp-build-systems.rst index 19d9cada6e..79cbad9d96 100644 --- a/docs/source/cordapp-build-systems.rst +++ b/docs/source/cordapp-build-systems.rst @@ -25,7 +25,7 @@ JAR will contain: Build tools ----------- -In the instructions that follow, we assume you are using Gradle and the ``cordformation`` plugin to build your +In the instructions that follow, we assume you are using Gradle and the ``cordapp`` plugin to build your CorDapp. You can find examples of building a CorDapp using these tools in the `Kotlin CorDapp Template `_ and the `Java CorDapp Template `_. @@ -66,14 +66,17 @@ In certain cases, you may also wish to build against the unstable Master branch. Corda dependencies ^^^^^^^^^^^^^^^^^^ -The ``cordformation`` plugin adds two new gradle configurations: +The ``cordapp`` plugin adds three new gradle configurations: * ``cordaCompile``, which extends ``compile`` * ``cordaRuntime``, which extends ``runtime`` +* ``cordapp``, which extends ``compile`` ``cordaCompile`` and ``cordaRuntime`` indicate dependencies that should not be included in the CorDapp JAR. These configurations should be used for any Corda dependency (e.g. ``corda-core``, ``corda-node``) in order to prevent a -dependency from being included twice (once in the CorDapp JAR and once in the Corda JARs). +dependency from being included twice (once in the CorDapp JAR and once in the Corda JARs). The ``cordapp`` dependency +is for declaring a compile-time dependency on a "semi-fat" CorDapp JAR in the same way as ``cordaCompile``, except +that ``Cordformation`` will only deploy CorDapps contained within the ``cordapp`` configuration. Here are some guidelines for Corda dependencies: @@ -81,15 +84,17 @@ Here are some guidelines for Corda dependencies: ``cordaCompile`` dependency, and ``net.corda:corda:$corda_release_version`` as a ``cordaRuntime`` dependency * When building an RPC client that communicates with a node (e.g. a webserver), you should include - ``net.corda:corda-rpc:$corda_release_version`` as a ``cordaCompile`` dependency + ``net.corda:corda-rpc:$corda_release_version`` as a ``cordaCompile`` dependency. * When you need to use the network bootstrapper to bootstrap a local network (e.g. when using ``Cordformation``), you - should include ``net.corda:corda-node-api:$corda_release_version`` as a ``cordaCompile`` dependency + should include ``net.corda:corda-node-api:$corda_release_version`` as either a ``cordaRuntime`` or a ``runtimeOnly`` + dependency. You may also wish to include an implementation of SLF4J as a ``runtimeOnly`` dependency for the network + bootstrapper to use. * To use Corda's test frameworks, add ``net.corda:corda-test-utils:$corda_release_version`` as a ``testCompile`` - dependency. Never include ``corda-test-utils`` as a ``compile`` or ``cordaCompile`` dependency + dependency. Never include ``corda-test-utils`` as a ``compile`` or ``cordaCompile`` dependency. -* Any other Corda dependencies you need should be included as ``cordaCompile`` dependencies +* Any other Corda dependencies you need should be included as ``cordaCompile`` dependencies. Here is an overview of the various Corda dependencies: @@ -107,7 +112,8 @@ Here is an overview of the various Corda dependencies: * ``corda-jfx`` - JavaFX utilities with some Corda-specific models and utilities. Only use with JavaFX apps * ``corda-mock`` - A small library of useful mocks. Use if the classes are useful to you * ``corda-node`` - The Corda node. Do not depend on. Used only by the Corda fat JAR and indirectly in testing - frameworks + frameworks. (If your CorDapp _must_ depend on this for some reason then it should use the ``compileOnly`` + configuration here - but please _don't_ do this if you can possibly avoid it!) * ``corda-node-api`` - The node API. Required to bootstrap a local network * ``corda-node-driver`` - Testing utility for programmatically starting nodes from JVM languages. Use for tests * ``corda-rpc`` - The Corda RPC client library. Used when writing an RPC client @@ -312,7 +318,7 @@ Below is a sample CorDapp Gradle dependencies block. When building your own CorD cordapp "net.corda:bank-of-corda-demo:1.0" // Some other dependencies - compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "junit:junit:$junit_version" diff --git a/docs/source/tutorial-attachments.rst b/docs/source/tutorial-attachments.rst index 60c1056fbc..871231afb0 100644 --- a/docs/source/tutorial-attachments.rst +++ b/docs/source/tutorial-attachments.rst @@ -105,7 +105,7 @@ and if so, printed out. .. container:: codeset - .. literalinclude:: ../../samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt + .. literalinclude:: ../../samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt :language: kotlin :start-after: DOCSTART 1 :end-before: DOCEND 1 @@ -115,7 +115,7 @@ transaction and send it to the recipient node: .. container:: codeset - .. literalinclude:: ../../samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt + .. literalinclude:: ../../samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt :language: kotlin :start-after: DOCSTART 2 :end-before: DOCEND 2 diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index f558c2619a..076d78848b 100644 --- a/samples/attachment-demo/build.gradle +++ b/samples/attachment-demo/build.gradle @@ -1,17 +1,68 @@ 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' description 'Corda attachment demo' +cordapp { + info { + name "Corda Attachment Demo" + vendor "R3" + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + } +} + +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" + compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version" + compile "javax.servlet:javax.servlet-api:3.1.0" + compile "javax.ws.rs:javax.ws.rs-api:2.0.1" + cordaCompile project(':client:rpc') + + // Cordformation needs a SLF4J implementation when executing the Network + // Bootstrapper, but Log4J doesn't shutdown completely from within Gradle. + // Use a much simpler SLF4J implementation here instead. + runtimeOnly "org.slf4j:slf4j-simple:$slf4j_version" + // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') cordaRuntime project(path: ":webserver:webcapsule", configuration: 'runtimeArtifacts') cordapp project(':samples:attachment-demo:contracts') cordapp project(':samples:attachment-demo:workflows') + + testCompile(project(':node-driver')) { + // We already have a SLF4J implementation on our runtime classpath, + // and we don't need another one. + exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl' + } + testCompile "junit:junit:$junit_version" + testCompile "org.assertj:assertj-core:$assertj_version" + + integrationTestCompile project(':webserver') +} + +task integrationTest(type: Test, dependsOn: []) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath } def nodeTask = tasks.getByPath(':node:capsule:assemble') @@ -25,7 +76,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, "InvokeRpc.internalVerifiedTransactionsFeed", "InvokeRpc.startTrackedFlowDynamic"]]] - directory "./build/nodes" nodeDefaults { projectCordapp { deploy = false @@ -70,16 +120,16 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, } } -task runSender(type: JavaExec) { +task runSender(type: JavaExec, dependsOn: jar) { classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.attachmentdemo.workflows.AttachmentDemoKt' + main = 'net.corda.attachmentdemo.AttachmentDemoKt' args '--role' args 'SENDER' } -task runRecipient(type: JavaExec) { +task runRecipient(type: JavaExec, dependsOn: jar) { classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.attachmentdemo.workflows.AttachmentDemoKt' + main = 'net.corda.attachmentdemo.AttachmentDemoKt' args '--role' args 'RECIPIENT' } diff --git a/samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt b/samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt similarity index 95% rename from samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt rename to samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt index 4bbdef6e77..be9e74528b 100644 --- a/samples/attachment-demo/workflows/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt +++ b/samples/attachment-demo/src/integration-test/kotlin/net/corda/attachmentdemo/AttachmentDemoTest.kt @@ -1,7 +1,5 @@ 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 diff --git a/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt similarity index 70% rename from samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt rename to samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt index 2c47a3cafe..ebe4d8e1e8 100644 --- a/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemo.kt +++ b/samples/attachment-demo/src/main/kotlin/net/corda/attachmentdemo/AttachmentDemo.kt @@ -1,28 +1,19 @@ -package net.corda.attachmentdemo.workflows +package net.corda.attachmentdemo -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.attachmentdemo.workflows.AttachmentDemoFlow import net.corda.client.rpc.CordaRPCClient import net.corda.core.crypto.SecureHash -import net.corda.core.flows.* -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.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 java.io.InputStream import java.net.HttpURLConnection import java.net.URL -import java.util.concurrent.Executors -import java.util.concurrent.ScheduledExecutorService import java.util.jar.JarInputStream import javax.servlet.http.HttpServletResponse.SC_OK import javax.ws.rs.core.HttpHeaders.CONTENT_DISPOSITION @@ -92,51 +83,6 @@ private fun sender(rpc: CordaRPCOps, inputStream: InputStream, hash: SecureHash. } // DOCEND 2 -@InitiatingFlow -@StartableByRPC -class AttachmentDemoFlow(private val otherSide: Party, - private val notary: Party, - private val attachId: SecureHash.SHA256) : FlowLogic() { - - object SIGNING : ProgressTracker.Step("Signing transaction") - - override val progressTracker: ProgressTracker = ProgressTracker(SIGNING) - - @Suspendable - override fun call(): SignedTransaction { - // Create a trivial transaction with an output that describes the attachment, and the attachment itself - val ptx = TransactionBuilder(notary) - .addOutputState(AttachmentContract.State(attachId), ATTACHMENT_PROGRAM_ID) - .addCommand(AttachmentContract.Command, ourIdentity.owningKey) - .addAttachment(attachId) - - progressTracker.currentStep = SIGNING - - val stx = serviceHub.signInitialTransaction(ptx) - - // Send the transaction to the other recipient - return subFlow(FinalityFlow(stx, initiateFlow(otherSide))) - } -} - -@InitiatedBy(AttachmentDemoFlow::class) -class StoreAttachmentFlow(private val otherSide: FlowSession) : FlowLogic() { - @Suspendable - override fun call() { - // As a non-participant to the transaction we need to record all states - subFlow(ReceiveFinalityFlow(otherSide, statesToRecord = StatesToRecord.ALL_VISIBLE)) - } -} - -@StartableByRPC -@StartableByService -class NoProgressTrackerShellDemo : FlowLogic() { - @Suspendable - override fun call(): String { - return "You Called me!" - } -} - @Suppress("DEPRECATION") // DOCSTART 1 fun recipient(rpc: CordaRPCOps, webPort: Int) { @@ -159,7 +105,7 @@ fun recipient(rpc: CordaRPCOps, webPort: Int) { // Write out the entries inside this jar. println("Attachment JAR contains these entries:") - JarInputStream(connection.inputStream).use { it -> + JarInputStream(connection.inputStream).use { while (true) { val e = it.nextJarEntry ?: break println("Entry> ${e.name}") diff --git a/samples/attachment-demo/workflows/src/main/resources/bank-of-london-cp.jar b/samples/attachment-demo/src/main/resources/bank-of-london-cp.jar similarity index 100% rename from samples/attachment-demo/workflows/src/main/resources/bank-of-london-cp.jar rename to samples/attachment-demo/src/main/resources/bank-of-london-cp.jar diff --git a/samples/attachment-demo/src/main/resources/simplelogger.properties b/samples/attachment-demo/src/main/resources/simplelogger.properties new file mode 100644 index 0000000000..8ce4c88201 --- /dev/null +++ b/samples/attachment-demo/src/main/resources/simplelogger.properties @@ -0,0 +1,3 @@ +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z diff --git a/samples/attachment-demo/workflows/build.gradle b/samples/attachment-demo/workflows/build.gradle index 132c345fbd..09d4f45d55 100644 --- a/samples/attachment-demo/workflows/build.gradle +++ b/samples/attachment-demo/workflows/build.gradle @@ -5,34 +5,12 @@ 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 { diff --git a/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemoFlow.kt b/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemoFlow.kt new file mode 100644 index 0000000000..20b8a1afb5 --- /dev/null +++ b/samples/attachment-demo/workflows/src/main/kotlin/net/corda/attachmentdemo/workflows/AttachmentDemoFlow.kt @@ -0,0 +1,57 @@ +package net.corda.attachmentdemo.workflows + +import co.paralleluniverse.fibers.Suspendable +import net.corda.attachmentdemo.contracts.ATTACHMENT_PROGRAM_ID +import net.corda.attachmentdemo.contracts.AttachmentContract +import net.corda.core.crypto.SecureHash +import net.corda.core.flows.* +import net.corda.core.identity.Party +import net.corda.core.node.StatesToRecord +import net.corda.core.transactions.SignedTransaction +import net.corda.core.transactions.TransactionBuilder +import net.corda.core.utilities.ProgressTracker + +@InitiatingFlow +@StartableByRPC +class AttachmentDemoFlow(private val otherSide: Party, + private val notary: Party, + private val attachId: SecureHash.SHA256) : FlowLogic() { + + object SIGNING : ProgressTracker.Step("Signing transaction") + + override val progressTracker: ProgressTracker = ProgressTracker(SIGNING) + + @Suspendable + override fun call(): SignedTransaction { + // Create a trivial transaction with an output that describes the attachment, and the attachment itself + val ptx = TransactionBuilder(notary) + .addOutputState(AttachmentContract.State(attachId), ATTACHMENT_PROGRAM_ID) + .addCommand(AttachmentContract.Command, ourIdentity.owningKey) + .addAttachment(attachId) + + progressTracker.currentStep = SIGNING + + val stx = serviceHub.signInitialTransaction(ptx) + + // Send the transaction to the other recipient + return subFlow(FinalityFlow(stx, initiateFlow(otherSide))) + } +} + +@InitiatedBy(AttachmentDemoFlow::class) +class StoreAttachmentFlow(private val otherSide: FlowSession) : FlowLogic() { + @Suspendable + override fun call() { + // As a non-participant to the transaction we need to record all states + subFlow(ReceiveFinalityFlow(otherSide, statesToRecord = StatesToRecord.ALL_VISIBLE)) + } +} + +@StartableByRPC +@StartableByService +class NoProgressTrackerShellDemo : FlowLogic() { + @Suspendable + override fun call(): String { + return "You Called me!" + } +} diff --git a/samples/cordapp-configuration/build.gradle b/samples/cordapp-configuration/build.gradle index bbdaca4a0f..ea2def65c5 100644 --- a/samples/cordapp-configuration/build.gradle +++ b/samples/cordapp-configuration/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'idea' apply plugin: 'net.corda.plugins.cordformation' dependencies { - compile project(':node-api') + runtimeOnly project(':node-api') runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version" // Corda integration dependencies diff --git a/samples/simm-valuation-demo/flows/src/main/resources/log4j2.xml b/samples/cordapp-configuration/src/main/resources/log4j2.xml similarity index 89% rename from samples/simm-valuation-demo/flows/src/main/resources/log4j2.xml rename to samples/cordapp-configuration/src/main/resources/log4j2.xml index 1c4164a050..986f04813e 100644 --- a/samples/simm-valuation-demo/flows/src/main/resources/log4j2.xml +++ b/samples/cordapp-configuration/src/main/resources/log4j2.xml @@ -1,9 +1,11 @@ - + + + - logs - node-${hostName} + build/logs + cordapp-${hostName} ${log-path}/archive diff --git a/samples/cordapp-configuration/workflows/build.gradle b/samples/cordapp-configuration/workflows/build.gradle index 01addff34c..4e9f698afc 100644 --- a/samples/cordapp-configuration/workflows/build.gradle +++ b/samples/cordapp-configuration/workflows/build.gradle @@ -1,7 +1,5 @@ apply plugin: 'kotlin' -apply plugin: 'idea' apply plugin: 'net.corda.plugins.cordapp' -apply plugin: 'net.corda.plugins.cordformation' dependencies { cordaCompile project(':core') diff --git a/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt b/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt index 9254df4343..192cad9347 100644 --- a/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt +++ b/samples/cordapp-configuration/workflows/src/main/kotlin/net/corda/configsample/GetStringConfigFlow.kt @@ -1,14 +1,8 @@ package net.corda.configsample import co.paralleluniverse.fibers.Suspendable -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.serialization.CordaSerializable -import net.corda.core.transactions.LedgerTransaction import net.corda.core.utilities.ProgressTracker // DOCSTART 1 diff --git a/samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml b/samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml deleted file mode 100644 index f82d09a079..0000000000 --- a/samples/cordapp-configuration/workflows/src/main/resources/log4j2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/samples/irs-demo/cordapp/build.gradle b/samples/irs-demo/cordapp/build.gradle index 3ffb92b4b4..fb7be3f848 100644 --- a/samples/irs-demo/cordapp/build.gradle +++ b/samples/irs-demo/cordapp/build.gradle @@ -17,14 +17,22 @@ sourceSets { } } +cordapp { + info { + name "Corda IRS Demo" + vendor "R3" + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + } +} + dependencies { cordapp project(':finance:contracts') cordapp project(':finance:workflows') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') - cordaCompile project(':core') - cordaRuntime project(':node-api') + runtimeOnly "org.slf4j:slf4j-simple:$slf4j_version" cordapp project(':samples:irs-demo:cordapp:contracts-irs') cordapp project(':samples:irs-demo:cordapp:workflows-irs') diff --git a/samples/irs-demo/cordapp/src/main/resources/simplelogger.properties b/samples/irs-demo/cordapp/src/main/resources/simplelogger.properties new file mode 100644 index 0000000000..8ce4c88201 --- /dev/null +++ b/samples/irs-demo/cordapp/src/main/resources/simplelogger.properties @@ -0,0 +1,3 @@ +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z diff --git a/samples/network-verifier/build.gradle b/samples/network-verifier/build.gradle index 51ecd18e05..2465cc78c5 100644 --- a/samples/network-verifier/build.gradle +++ b/samples/network-verifier/build.gradle @@ -2,9 +2,23 @@ apply plugin: 'kotlin' apply plugin: 'net.corda.plugins.cordapp' apply plugin: 'net.corda.plugins.cordformation' +cordapp { + info { + name "Corda Network Verifier" + vendor "R3" + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + } +} + dependencies { - cordaCompile project(':core') - cordaCompile project(':node-api') + // Cordformation needs this for the Network Bootstrapper. + runtimeOnly project(':node-api') + + // Cordformation needs a SLF4J implementation when executing the Network + // Bootstrapper, but Log4J doesn't shutdown completely from within Gradle. + // Use a much simpler SLF4J implementation here instead. + runtimeOnly "org.slf4j:slf4j-simple:$slf4j_version" // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') @@ -23,7 +37,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) cordapp project(':samples:network-verifier:contracts') cordapp project(':samples:network-verifier:workflows') } - directory "./build/nodes" node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : false] diff --git a/samples/network-verifier/src/main/resources/simplelogger.properties b/samples/network-verifier/src/main/resources/simplelogger.properties new file mode 100644 index 0000000000..8ce4c88201 --- /dev/null +++ b/samples/network-verifier/src/main/resources/simplelogger.properties @@ -0,0 +1,3 @@ +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z diff --git a/samples/notary-demo/build.gradle b/samples/notary-demo/build.gradle index 51409be9c5..d74a1d3fa2 100644 --- a/samples/notary-demo/build.gradle +++ b/samples/notary-demo/build.gradle @@ -1,17 +1,29 @@ import net.corda.plugins.Cordform -apply plugin: 'java' 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' +cordapp { + info { + name "Corda Notary Demo" + vendor "R3" + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + } +} + dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" + cordaCompile project(':client:rpc') // Corda integration dependencies cordaRuntime project(path: ":node:capsule", configuration: 'runtimeArtifacts') - cordaCompile project(':core') + + // Cordformation needs a SLF4J implementation when executing the Network + // Bootstrapper, but Log4J doesn't shutdown completely from within Gradle. + // Use a much simpler SLF4J implementation here instead. + runtimeOnly "org.slf4j:slf4j-simple:$slf4j_version" // Notary implementations cordapp project(':samples:notary-demo:contracts') @@ -240,7 +252,7 @@ task deployNodesBFT(type: Cordform, dependsOn: ['jar', nodeTask, webTask]) { } } -task notarise(type: JavaExec) { +task notarise(type: JavaExec, dependsOn: jar) { classpath = sourceSets.main.runtimeClasspath - main = 'net.corda.notarydemo.NotariseKt' + main = 'net.corda.notarydemo.client.NotariseKt' } diff --git a/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/client/Notarise.kt similarity index 98% rename from samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt rename to samples/notary-demo/src/main/kotlin/net/corda/notarydemo/client/Notarise.kt index 93d71a8106..0f1648752d 100644 --- a/samples/notary-demo/workflows/src/main/kotlin/net/corda/notarydemo/Notarise.kt +++ b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/client/Notarise.kt @@ -1,4 +1,4 @@ -package net.corda.notarydemo +package net.corda.notarydemo.client import net.corda.client.rpc.CordaRPCClient import net.corda.core.crypto.CompositeKey diff --git a/samples/notary-demo/src/main/resources/simplelogger.properties b/samples/notary-demo/src/main/resources/simplelogger.properties new file mode 100644 index 0000000000..8ce4c88201 --- /dev/null +++ b/samples/notary-demo/src/main/resources/simplelogger.properties @@ -0,0 +1,3 @@ +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z diff --git a/samples/notary-demo/workflows/build.gradle b/samples/notary-demo/workflows/build.gradle index 85ea6160df..4113819912 100644 --- a/samples/notary-demo/workflows/build.gradle +++ b/samples/notary-demo/workflows/build.gradle @@ -6,7 +6,11 @@ description 'Corda Notary Demo - Workflows' dependencies { cordaCompile project(':core') cordaCompile project(':client:rpc') - cordaCompile project(':node') + + // We need to compile against the Node, but also DO NOT + // want the Node bundled inside the CorDapp or added to + // Gradle's runtime classpath. + compileOnly project(':node') cordapp project(':samples:notary-demo:contracts') } diff --git a/samples/simm-valuation-demo/build.gradle b/samples/simm-valuation-demo/build.gradle index b7db45d7aa..73fb8d5fd3 100644 --- a/samples/simm-valuation-demo/build.gradle +++ b/samples/simm-valuation-demo/build.gradle @@ -62,6 +62,11 @@ dependencies { testCompile "org.assertj:assertj-core:$assertj_version" } +jar { + // A CorDapp does not configure the Node's logging! + exclude "**/log4j2*.xml" +} + 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]) { diff --git a/samples/simm-valuation-demo/contracts-states/build.gradle b/samples/simm-valuation-demo/contracts-states/build.gradle index 7a88d84003..620588c605 100644 --- a/samples/simm-valuation-demo/contracts-states/build.gradle +++ b/samples/simm-valuation-demo/contracts-states/build.gradle @@ -53,7 +53,7 @@ task shrink(type: ProGuardTask) { libraryjars "$javaHome/lib/rt.jar" libraryjars "$javaHome/lib/jce.jar" - configurations.runtime.forEach { + configurations.runtimeClasspath.forEach { libraryjars it.path, filter: '!META-INF/versions/**' } diff --git a/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt b/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt index 55cb488b4b..3e34a1a42a 100644 --- a/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt +++ b/samples/simm-valuation-demo/src/integration-test/kotlin/net/corda/vega/SimmValuationTest.kt @@ -3,28 +3,20 @@ package net.corda.vega import com.opengamma.strata.product.common.BuySell import net.corda.core.identity.CordaX500Name import net.corda.core.internal.div -import net.corda.core.internal.packageName import net.corda.core.utilities.getOrThrow -import net.corda.serialization.internal.amqp.AbstractAMQPSerializationScheme import net.corda.testing.common.internal.ProjectStructure.projectRootDir import net.corda.testing.core.DUMMY_BANK_A_NAME import net.corda.testing.core.DUMMY_BANK_B_NAME -import net.corda.testing.core.DUMMY_NOTARY_NAME import net.corda.testing.driver.DriverParameters import net.corda.testing.driver.driver import net.corda.testing.http.HttpApi -import net.corda.testing.node.NotarySpec import net.corda.testing.node.internal.FINANCE_CORDAPPS import net.corda.testing.node.internal.findCordapp import net.corda.vega.api.PortfolioApi import net.corda.vega.api.PortfolioApiUtils import net.corda.vega.api.SwapDataModel import net.corda.vega.api.SwapDataView -import net.corda.vega.plugin.customserializers.CurrencyParameterSensitivitiesSerializer import org.assertj.core.api.Assertions.assertThat -import org.junit.After -import org.junit.Before -import org.junit.Ignore import org.junit.Test import java.math.BigDecimal import java.time.LocalDate diff --git a/samples/simm-valuation-demo/src/main/resources/log4j2.xml b/samples/simm-valuation-demo/src/main/resources/log4j2.xml index 1c4164a050..00795edc45 100644 --- a/samples/simm-valuation-demo/src/main/resources/log4j2.xml +++ b/samples/simm-valuation-demo/src/main/resources/log4j2.xml @@ -2,8 +2,8 @@ - logs - node-${hostName} + build/logs + simm-valuation-${hostName} ${log-path}/archive diff --git a/samples/trader-demo/build.gradle b/samples/trader-demo/build.gradle index 590f0c0483..1bb8e089b6 100644 --- a/samples/trader-demo/build.gradle +++ b/samples/trader-demo/build.gradle @@ -1,29 +1,71 @@ 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' +cordapp { + info { + name "Trader Demo" + vendor "R3" + targetPlatformVersion corda_platform_version.toInteger() + minimumPlatformVersion 1 + } +} + +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" + compile "net.sf.jopt-simple:jopt-simple:$jopt_simple_version" + cordaCompile project(':client:rpc') + + // Cordformation needs a SLF4J implementation when executing the Network + // Bootstrapper, but Log4J doesn't shutdown completely from within Gradle. + // Use a much simpler SLF4J implementation here instead. + runtimeOnly "org.slf4j:slf4j-simple:$slf4j_version" + + // We only need this for its DUMMY_BANK constants, and + // DO NOT want it added to Gradle's runtime classpath. + compileOnly project(':test-utils') // The trader demo CorDapp depends upon Cash CorDapp features cordapp project(':finance:contracts') cordapp project(':finance:workflows') - 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') - testCompile project(':test-utils') + testCompile(project(':node-driver')) { + // We already have a SLF4J implementation on our runtime classpath, + // and we don't need another one. + exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j-impl' + } testCompile "junit:junit:$junit_version" - testCompile "org.assertj:assertj-core:${assertj_version}" + testCompile "org.assertj:assertj-core:$assertj_version" +} + +task integrationTest(type: Test, dependsOn: []) { + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath } 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]) { +task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask]) { ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["ALL"]]] nodeDefaults { projectCordapp { @@ -33,7 +75,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar', nodeTask, cordapp project(':finance:contracts') cordapp project(':samples:trader-demo:workflows-trader') } - directory "./build/nodes" node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] @@ -96,15 +137,15 @@ idea { } } -task runBank(type: JavaExec) { - classpath = sourceSets.main.runtimeClasspath +task runBank(type: JavaExec, dependsOn: jar) { + classpath = sourceSets.test.runtimeClasspath main = 'net.corda.traderdemo.TraderDemoKt' args '--role' args 'BANK' } -task runSeller(type: JavaExec) { - classpath = sourceSets.main.runtimeClasspath +task runSeller(type: JavaExec, dependsOn: jar) { + classpath = sourceSets.test.runtimeClasspath main = 'net.corda.traderdemo.TraderDemoKt' args '--role' args 'SELLER' diff --git a/samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt b/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt similarity index 90% rename from samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt rename to samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt index cad856bb73..ea9dcdf086 100644 --- a/samples/trader-demo/workflows-trader/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt +++ b/samples/trader-demo/src/integration-test/kotlin/net/corda/traderdemo/TraderDemoTest.kt @@ -39,7 +39,7 @@ class TraderDemoTest { driver(DriverParameters( startNodesInProcess = true, inMemoryDB = false, - cordappsForAllNodes = FINANCE_CORDAPPS + TestCordapp.findCordapp("net.corda.traderdemo") + cordappsForAllNodes = FINANCE_CORDAPPS + TestCordapp.findCordapp("net.corda.traderdemo.flow") )) { val (nodeA, nodeB, bankNode) = listOf( startNode(providedName = DUMMY_BANK_A_NAME, rpcUsers = listOf(demoUser)), @@ -71,11 +71,14 @@ class TraderDemoTest { assertThat(clientB.cashCount).isEqualTo(expectedBCash) // Wait until A receives the commercial paper val executor = Executors.newScheduledThreadPool(1) - poll(executor, "A to be notified of the commercial paper", pollInterval = 100.millis) { - val actualPaper = listOf(clientA.commercialPaperCount, clientB.commercialPaperCount) - if (actualPaper == expectedPaper) Unit else null - }.getOrThrow() - executor.shutdown() + try { + poll(executor, "A to be notified of the commercial paper", pollInterval = 100.millis) { + val actualPaper = listOf(clientA.commercialPaperCount, clientB.commercialPaperCount) + if (actualPaper == expectedPaper) Unit else null + }.getOrThrow() + } finally { + executor.shutdownNow() + } assertThat(clientA.dollarCashBalance).isEqualTo(95.DOLLARS) assertThat(clientB.dollarCashBalance).isEqualTo(5.DOLLARS) } @@ -86,7 +89,7 @@ class TraderDemoTest { driver(DriverParameters( startNodesInProcess = false, inMemoryDB = false, - cordappsForAllNodes = FINANCE_CORDAPPS + TestCordapp.findCordapp("net.corda.traderdemo") + cordappsForAllNodes = FINANCE_CORDAPPS + TestCordapp.findCordapp("net.corda.traderdemo.flow") )) { val (buyer, seller, bank) = listOf( startNode(providedName = DUMMY_BANK_A_NAME), diff --git a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt similarity index 100% rename from samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt rename to samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemo.kt diff --git a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt b/samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt similarity index 100% rename from samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt rename to samples/trader-demo/src/main/kotlin/net/corda/traderdemo/TraderDemoClientApi.kt diff --git a/samples/trader-demo/workflows-trader/src/main/resources/bank-of-london-cp.jar b/samples/trader-demo/src/main/resources/bank-of-london-cp.jar similarity index 100% rename from samples/trader-demo/workflows-trader/src/main/resources/bank-of-london-cp.jar rename to samples/trader-demo/src/main/resources/bank-of-london-cp.jar diff --git a/samples/trader-demo/src/main/resources/simplelogger.properties b/samples/trader-demo/src/main/resources/simplelogger.properties new file mode 100644 index 0000000000..8ce4c88201 --- /dev/null +++ b/samples/trader-demo/src/main/resources/simplelogger.properties @@ -0,0 +1,3 @@ +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simpleLogger.showDateTime=true +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z diff --git a/samples/trader-demo/workflows-trader/build.gradle b/samples/trader-demo/workflows-trader/build.gradle index 05f6cf8178..5207820e62 100644 --- a/samples/trader-demo/workflows-trader/build.gradle +++ b/samples/trader-demo/workflows-trader/build.gradle @@ -1,45 +1,18 @@ 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" + cordaCompile project(':core') // The trader demo CorDapp depends upon Cash CorDapp features cordapp project(':finance:contracts') cordapp project(':finance:workflows') - cordapp project(':samples:bank-of-corda-demo') - - // Corda integration dependencies - cordaCompile project(':core') - - testCompile project(':test-utils') + + testCompile project(':node-driver') 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 + testCompile "org.assertj:assertj-core:$assertj_version" } jar { diff --git a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt index c32c3fe664..9734248e89 100644 --- a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt +++ b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/LoggingBuyerFlow.kt @@ -7,7 +7,6 @@ import net.corda.core.internal.Emoji import net.corda.core.transactions.SignedTransaction import net.corda.finance.contracts.CommercialPaper import net.corda.finance.workflows.getCashBalances -import net.corda.traderdemo.TransactionGraphSearch @InitiatedBy(SellerFlow::class) class LoggingBuyerFlow(private val otherSideSession: FlowSession) : BuyerFlow(otherSideSession) { diff --git a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/TransactionGraphSearch.kt similarity index 99% rename from samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt rename to samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/TransactionGraphSearch.kt index 684cd1724e..9f2cbf8ffe 100644 --- a/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/TransactionGraphSearch.kt +++ b/samples/trader-demo/workflows-trader/src/main/kotlin/net/corda/traderdemo/flow/TransactionGraphSearch.kt @@ -1,4 +1,4 @@ -package net.corda.traderdemo +package net.corda.traderdemo.flow import net.corda.core.contracts.CommandData import net.corda.core.contracts.ContractState diff --git a/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt b/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/flow/TransactionGraphSearchTests.kt similarity index 99% rename from samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt rename to samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/flow/TransactionGraphSearchTests.kt index 5cad922236..56f170ca41 100644 --- a/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/TransactionGraphSearchTests.kt +++ b/samples/trader-demo/workflows-trader/src/test/kotlin/net/corda/traderdemo/flow/TransactionGraphSearchTests.kt @@ -1,4 +1,4 @@ -package net.corda.traderdemo +package net.corda.traderdemo.flow import net.corda.core.contracts.CommandData import net.corda.core.crypto.newSecureRandom diff --git a/samples/trader-demo/workflows-trader/src/test/resources/log4j2-test.xml b/samples/trader-demo/workflows-trader/src/test/resources/log4j2-test.xml new file mode 100644 index 0000000000..b12cea5b2d --- /dev/null +++ b/samples/trader-demo/workflows-trader/src/test/resources/log4j2-test.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file