diff --git a/build.gradle b/build.gradle index 26fe8700a2..b4fe7f4073 100644 --- a/build.gradle +++ b/build.gradle @@ -109,17 +109,4 @@ tasks.withType(Test) { tasks.withType(JavaExec) { jvmArgs "-javaagent:${configurations.quasar.singleFile}" jvmArgs "-Dco.paralleluniverse.fibers.verifyInstrumentation" -} - - -task runDemoBuyer(type: JavaExec, dependsOn: ':classes') { - classpath = sourceSets.main.runtimeClasspath - main = 'core.node.TraderDemoKt' - args = ['--dir=buyer', '--service-fake-trades', '--network-address=localhost'] -} - -task runDemoSeller(type: JavaExec, dependsOn: ':classes') { - classpath = sourceSets.main.runtimeClasspath - main = 'core.node.TraderDemoKt' - args = ['--dir=seller', '--fake-trade-with=localhost', '--network-address=localhost:31338', '--timestamper-identity-file=buyer/identity-public', '--timestamper-address=localhost'] -} +} \ No newline at end of file diff --git a/docs/source/running-the-trading-demo.rst b/docs/source/running-the-trading-demo.rst index c8cf802e14..ffb35587f1 100644 --- a/docs/source/running-the-trading-demo.rst +++ b/docs/source/running-the-trading-demo.rst @@ -9,20 +9,20 @@ let us know. Now, open two terminals, and in the first run::: - ./gradlew runDemoBuyer + ./scripts/trader-demo.sh buyer -It will create a directory named "buyer" and ask you to edit the configuration file inside. Open up ``buyer/config`` -in your favourite text editor and give the node a legal identity of "Big Buyer Corp, Inc" or whatever else you feel like. -The actual text string is not important. Now run the gradle command again, and it should start up and wait for -a seller to connect. +It will compile things, if necessary, then create a directory named "buyer" with a bunch of files inside and start +the node. You should see it waiting for a trade to begin. In the second terminal, run:: - ./gradlew runDemoSeller - -and repeat the process, this time calling the node ... something else. + ./scripts/trader-demo.sh seller You should see some log lines scroll past, and within a few seconds the messages "Purchase complete - we are a happy customer!" and "Sale completed - we have a happy customer!" should be printed. -If it doesn't work, jump on the mailing list and let us know. \ No newline at end of file +If it doesn't work, jump on the mailing list and let us know. + +For Windows users, the contents of the shell script are very trivial and can easily be done by hand from a command +window. Essentially, it just runs Gradle to create the startup scripts, and then starts the node with one set of +flags or another. \ No newline at end of file diff --git a/scripts/trader-demo.sh b/scripts/trader-demo.sh new file mode 100755 index 0000000000..38daf4affb --- /dev/null +++ b/scripts/trader-demo.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +mode=$1 + +if [ ! -e ./gradlew ]; then + echo "Run from the root directory please" + exit 1 +fi + +if [ ! -d build/install/r3prototyping ]; then + ./gradlew installDist +fi + +if [[ "$mode" == "buyer" ]]; then + if [ ! -d buyer ]; then + mkdir buyer + echo "myLegalName = Bank of Zurich" >buyer/config + fi + + build/install/r3prototyping/bin/r3prototyping --dir=buyer --service-fake-trades --network-address=localhost +elif [[ "$mode" == "seller" ]]; then + if [ ! -d seller ]; then + mkdir seller + echo "myLegalName = Bank of Giza" >seller/config + fi + + build/install/r3prototyping/bin/r3prototyping --dir=seller --fake-trade-with=localhost --network-address=localhost:31338 --timestamper-identity-file=buyer/identity-public --timestamper-address=localhost +else + echo "Run like this, one in each tab:" + echo + echo " scripts/trader-demo.sh buyer" + echo " scripts/trader-demo.sh seller" +fi