Skip to content

Commit

Permalink
Update README and ci
Browse files Browse the repository at this point in the history
Signed-off-by: Stanislav Jakuschevskij <[email protected]>
  • Loading branch information
twoGiants committed Jan 9, 2025
1 parent f9285d5 commit 69c521f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
13 changes: 12 additions & 1 deletion ci/scripts/run-test-network-off-chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,22 @@ print "Initializing Typescript off-chain data application"
pushd ../off_chain_data/application-typescript
rm -f checkpoint.json store.log
npm install
print "Running the output app"
print "Running the Typescript app"
SIMULATED_FAILURE_COUNT=1 npm start getAllAssets transact getAllAssets listen
SIMULATED_FAILURE_COUNT=1 npm start listen
popd

# Run off-chain data Go application
export CHAINCODE_NAME=go_off_chain_data
deployChaincode
print "Initializing Go off-chain data application"
pushd ../off_chain_data/application-go
rm -f checkpoint.json store.log
print "Running the Go app"
SIMULATED_FAILURE_COUNT=1 go run . getAllAssets transact getAllAssets listen
SIMULATED_FAILURE_COUNT=1 go run . listen
popd

# Run off-chain data Java application
#createNetwork
export CHAINCODE_NAME=off_chain_data
Expand Down
14 changes: 14 additions & 0 deletions off_chain_data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ The Fabric test network is used to deploy and run this sample. Follow these step
npm install
npm start transact listen

# To run the Go sample application
cd application-go
go run . transact listen

# To run the Java sample application
cd application-java
./gradlew run --quiet --args='transact listen'
Expand All @@ -79,6 +83,10 @@ The Fabric test network is used to deploy and run this sample. Follow these step
cd application-typescript
npm --silent start getAllAssets

# To run the Go sample application
cd application-go
go run . getAllAssets

# To run the Java sample application
cd application-java
./gradlew run --quiet --args=getAllAssets
Expand All @@ -93,6 +101,12 @@ The Fabric test network is used to deploy and run this sample. Follow these step
SIMULATED_FAILURE_COUNT=5 npm start listen
npm start listen

# To run the Go sample application
cd application-go
go run . transact
SIMULATED_FAILURE_COUNT=5 go run . listen
go run . listen

# To run the Java sample application
cd application-java
./gradlew run --quiet --args=transact
Expand Down
9 changes: 7 additions & 2 deletions off_chain_data/application-go/getAllAssets.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@ func getAllAssets(clientConnection *grpc.ClientConn) {
id, options := newConnectOptions(clientConnection)
gateway, err := client.Connect(id, options...)
if err != nil {
panic((err))
panic(err)
}
defer gateway.Close()

contract := gateway.GetNetwork(channelName).GetContract(chaincodeName)
smartContract := atb.NewAssetTransferBasic(contract)
assets, err := smartContract.GetAllAssets()
if err != nil {
panic((err))
panic(err)
}

if len(assets) == 0 {
fmt.Println("no assets")
return
}

fmt.Println(formatJSON(assets))
Expand Down

0 comments on commit 69c521f

Please sign in to comment.