mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
Samples: make the attachment demo runnable from the command line again.
This commit is contained in:
parent
0e6e1e4457
commit
b3a70c7acb
15
.idea/runConfigurations/Attachment_Demo__Run_Nodes.xml
generated
Normal file
15
.idea/runConfigurations/Attachment_Demo__Run_Nodes.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Attachment Demo: Run Nodes" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.attachmentdemo.MainKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="attachment-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
15
.idea/runConfigurations/Attachment_Demo__Run_Recipient.xml
generated
Normal file
15
.idea/runConfigurations/Attachment_Demo__Run_Recipient.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Attachment Demo: Run Recipient" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.attachmentdemo.AttachmentDemoKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role=RECIPIENT" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="attachment-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
15
.idea/runConfigurations/Attachment_Demo__Run_Sender.xml
generated
Normal file
15
.idea/runConfigurations/Attachment_Demo__Run_Sender.xml
generated
Normal file
@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Attachment Demo: Run Sender" type="JetRunConfigurationType" factoryName="Kotlin" singleton="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.corda.attachmentdemo.AttachmentDemoKt" />
|
||||
<option name="VM_PARAMETERS" value="-ea -javaagent:lib/quasar.jar " />
|
||||
<option name="PROGRAM_PARAMETERS" value="--role SENDER" />
|
||||
<option name="WORKING_DIRECTORY" value="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="attachment-demo_main" />
|
||||
<envs />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
@ -69,6 +69,17 @@ blotter to view it.
|
||||
Attachment demo
|
||||
---------------
|
||||
|
||||
This demo brings up three nodes, and sends a transaction containing an attachment from one to the other. To run
|
||||
it from the command line (recommended for Mac/UNIX users!):
|
||||
|
||||
1. Run ``./gradlew samples:attachment-demo:deployNodes`` to create a set of configs and installs under ``samples/trader-demo/build/nodes``
|
||||
2. Run ``./samples/attachment-demo/build/nodes/runnodes`` to open up three new terminal tabs/windows with the three nodes.
|
||||
3. Run ``./gradlew samples:attachment-demo:runRecipient``, which will block waiting for something to happen.
|
||||
4. Run ``./gradlew samples:attachment-demo:runSender`` in another terminal window to trigger the transaction.
|
||||
Now look at the other windows to see the output of the demo.
|
||||
|
||||
Or you can run them from inside IntelliJ, but when done this way, all the node output is printed to a single console.
|
||||
|
||||
1. Open the Corda project in IntelliJ and run the "Install" configuration
|
||||
2. Open the Corda samples project in IntelliJ and run the "Attachment Demo: Run Nodes" configuration
|
||||
3. Run "Attachment Demo: Run Recipient" - this waits for a trade to start
|
||||
|
@ -3,52 +3,4 @@
|
||||
Please see docs/build/html/running-the-demos.html and docs/build/html/tutorial-attachments.html
|
||||
|
||||
This program is a simple demonstration of sending a transaction with an attachment from one node to another, and
|
||||
then accessing the attachment on the remote node.
|
||||
|
||||
The different roles in the scenario this program can adopt are:
|
||||
|
||||
## Prerequisites
|
||||
|
||||
You will need to have [JDK 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
|
||||
installed and available on your path.
|
||||
|
||||
## Getting Started
|
||||
|
||||
First clone this repository and the Corda repository locally. Then open a terminal window in the Corda directory and run:
|
||||
|
||||
Unix:
|
||||
|
||||
./gradlew publishToMavenLocal
|
||||
|
||||
Windows:
|
||||
|
||||
gradle.bat publishToMavenLocal
|
||||
|
||||
This will publish a copy of Corda to your local Maven repository for your Cordapp to use. Next open a terminal window
|
||||
in your Cordapp directory (this one) and run:
|
||||
|
||||
Unix:
|
||||
|
||||
./gradlew deployNodes
|
||||
|
||||
Windows:
|
||||
|
||||
gradlew.bat deployNodes
|
||||
|
||||
This command will create several nodes in `build/nodes` that you can now run with:
|
||||
|
||||
Unix:
|
||||
|
||||
cd build/nodes
|
||||
./runnodes
|
||||
|
||||
Windows:
|
||||
|
||||
cd build/nodes
|
||||
ruunnodes.bat
|
||||
|
||||
This will now have nodes running on your machine running this Cordapp. You can now begin developing your Cordapp.
|
||||
|
||||
## Further Reading
|
||||
|
||||
Tutorials and developer docs for Cordapps and Corda are [here](https://docs.corda.r3cev.com).
|
||||
then accessing the attachment on the remote node.
|
@ -91,7 +91,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install']) {
|
||||
cordapps = []
|
||||
}
|
||||
node {
|
||||
name "NodeA"
|
||||
name "Bank A"
|
||||
dirName "nodea"
|
||||
nearestCity "London"
|
||||
advertisedServices = []
|
||||
@ -100,7 +100,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: [':install']) {
|
||||
cordapps = []
|
||||
}
|
||||
node {
|
||||
name "NodeB"
|
||||
name "Bank B"
|
||||
dirName "nodeb"
|
||||
nearestCity "New York"
|
||||
advertisedServices = []
|
||||
@ -135,3 +135,17 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task runSender(type: JavaExec) {
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
main = 'net.corda.attachmentdemo.AttachmentDemoKt'
|
||||
args '--role'
|
||||
args 'SENDER'
|
||||
}
|
||||
|
||||
task runRecipient(type: JavaExec) {
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
main = 'net.corda.attachmentdemo.AttachmentDemoKt'
|
||||
args '--role'
|
||||
args 'RECIPIENT'
|
||||
}
|
@ -10,7 +10,7 @@ import net.corda.node.services.transactions.SimpleNotaryService
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
driver(dsl = {
|
||||
startNode("Notary", setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
||||
startNode("Controller", setOf(ServiceInfo(SimpleNotaryService.Companion.type)))
|
||||
startNode("Bank A")
|
||||
startNode("Bank B")
|
||||
waitForAllNodesToFinish()
|
||||
|
Loading…
Reference in New Issue
Block a user