Use a Mock Shim to Test a Chaincode
This method of testing involves using a mock version of the stub shim.ChaincodeStubInterface
. With this you can simulate some functionality of your chaincode before deploying it to Oracle Blockchain
Platform. You can also use this library to build unit tests for your chaincode.
Manually Vendor the Shim with a Chaincode
This applies to Oracle Blockchain Platform 19.1.1, 19.1.3, 19.2.1, and 19.2.3.
In Hyperledger Fabric, the fabric-ccenv image contains the github.com/hyperledger/fabric/core/chaincode/shim
(shim) package. This allows you to package a chaincode without needing to include the shim. However, this may cause issues in future Hyperledger Fabric releases, and it may cause issues when using packages that are included with the shim.
Workaround: To avoid potential issues, you should manually vendor the shim package with the chaincode prior to using the peer
command-line interface for packaging and installing a chaincode, or packaging or installing a chaincode. See https://jira.hyperledger.org/browse/FAB-5177.
Use a Mock Shim to Test a Chaincode
Note:
Not all interfaces of the stub are implemented. Stub functions-
GetQueryResult
-
GetHistoryForKey