mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Trader demo: use a start script instead of Gradle, which simplifies setup.
It also stops Gradle messing with the console output.
This commit is contained in:
parent
c3f86f6557
commit
478b6c5fba
15
build.gradle
15
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']
|
||||
}
|
||||
}
|
@ -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.
|
||||
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.
|
33
scripts/trader-demo.sh
Executable file
33
scripts/trader-demo.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user