mirror of
https://github.com/corda/corda.git
synced 2025-06-16 06:08:13 +00:00
Merge branch 'master' into release/4
This commit is contained in:
@ -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'
|
||||
|
@ -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),
|
@ -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
|
@ -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 {
|
||||
@ -55,4 +28,4 @@ cordapp {
|
||||
vendor "R3"
|
||||
licence "Open Source (Apache 2)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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
|
@ -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
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="info">
|
||||
|
||||
<ThresholdFilter level="info"/>
|
||||
<Appenders>
|
||||
<Console name="Console-Appender" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%date %highlight{%level %c{1}.%method - %msg%n}{INFO=white,WARN=red,FATAL=bright red}"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="Console-Appender"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
|
||||
</Configuration>
|
Reference in New Issue
Block a user