File tree Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Expand file tree Collapse file tree 3 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -41,11 +41,22 @@ print "Initializing Typescript off-chain data application"
4141pushd ../off_chain_data/application-typescript
4242rm -f checkpoint.json store.log
4343npm install
44- print " Running the output app"
44+ print " Running the Typescript app"
4545SIMULATED_FAILURE_COUNT=1 npm start getAllAssets transact getAllAssets listen
4646SIMULATED_FAILURE_COUNT=1 npm start listen
4747popd
4848
49+ # Run off-chain data Go application
50+ export CHAINCODE_NAME=go_off_chain_data
51+ deployChaincode
52+ print " Initializing Go off-chain data application"
53+ pushd ../off_chain_data/application-go
54+ rm -f checkpoint.json store.log
55+ print " Running the Go app"
56+ SIMULATED_FAILURE_COUNT=1 go run . getAllAssets transact getAllAssets listen
57+ SIMULATED_FAILURE_COUNT=1 go run . listen
58+ popd
59+
4960# Run off-chain data Java application
5061# createNetwork
5162export CHAINCODE_NAME=off_chain_data
Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ The Fabric test network is used to deploy and run this sample. Follow these step
6565 npm install
6666 npm start transact listen
6767
68+ # To run the Go sample application
69+ cd application-go
70+ go run . transact listen
71+
6872 # To run the Java sample application
6973 cd application-java
7074 ./gradlew run --quiet --args=' transact listen'
@@ -79,6 +83,10 @@ The Fabric test network is used to deploy and run this sample. Follow these step
7983 cd application-typescript
8084 npm --silent start getAllAssets
8185
86+ # To run the Go sample application
87+ cd application-go
88+ go run . getAllAssets
89+
8290 # To run the Java sample application
8391 cd application-java
8492 ./gradlew run --quiet --args=getAllAssets
@@ -93,6 +101,12 @@ The Fabric test network is used to deploy and run this sample. Follow these step
93101 SIMULATED_FAILURE_COUNT=5 npm start listen
94102 npm start listen
95103
104+ # To run the Go sample application
105+ cd application-go
106+ go run . transact
107+ SIMULATED_FAILURE_COUNT=5 go run . listen
108+ go run . listen
109+
96110 # To run the Java sample application
97111 cd application-java
98112 ./gradlew run --quiet --args=transact
Original file line number Diff line number Diff line change @@ -20,15 +20,20 @@ func getAllAssets(clientConnection *grpc.ClientConn) {
2020 id , options := newConnectOptions (clientConnection )
2121 gateway , err := client .Connect (id , options ... )
2222 if err != nil {
23- panic (( err ) )
23+ panic (err )
2424 }
2525 defer gateway .Close ()
2626
2727 contract := gateway .GetNetwork (channelName ).GetContract (chaincodeName )
2828 smartContract := atb .NewAssetTransferBasic (contract )
2929 assets , err := smartContract .GetAllAssets ()
3030 if err != nil {
31- panic ((err ))
31+ panic (err )
32+ }
33+
34+ if len (assets ) == 0 {
35+ fmt .Println ("no assets" )
36+ return
3237 }
3338
3439 fmt .Println (formatJSON (assets ))
You can’t perform that action at this time.
0 commit comments