Skip to content

Commit 69c521f

Browse files
committed
Update README and ci
Signed-off-by: Stanislav Jakuschevskij <stas@two-giants.com>
1 parent f9285d5 commit 69c521f

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

ci/scripts/run-test-network-off-chain.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,22 @@ print "Initializing Typescript off-chain data application"
4141
pushd ../off_chain_data/application-typescript
4242
rm -f checkpoint.json store.log
4343
npm install
44-
print "Running the output app"
44+
print "Running the Typescript app"
4545
SIMULATED_FAILURE_COUNT=1 npm start getAllAssets transact getAllAssets listen
4646
SIMULATED_FAILURE_COUNT=1 npm start listen
4747
popd
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
5162
export CHAINCODE_NAME=off_chain_data

off_chain_data/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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

off_chain_data/application-go/getAllAssets.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff 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))

0 commit comments

Comments
 (0)