End2EndIT

End2EndIT:

1. SampleUser
1.1 name
1.2 roles
1.3 account
1.4 affiliation
1.5 organization
1.6 enrollmentSecret
1.7 Enrollment
1.8 support serialize & deserialize

2. SampleOrg
2.1 name
2.2 mspid
2.3 HFCAClient
2.4 userlist with names
2.5 peer location list with names
2.6 orderer location list with names
2.7 event hub locations list with names
2.8 SampleUser admin
2.9 ca location
2.10 ca properties
2.11 SampleUser peer admin
2.12 domian name

3. Check config
3.1 reset config
3.2 customize config
3.3 get all test sample orgs
3.4 set HFCAClient to sample org for every one with ca name & ca location & ca properties

4. Test
4.1 Clear Store
4.2 make store ready to save users, orgs
4.2.1 enroll users
4.2.1.1 for every sample org
4.2.1.2 set HFCAClient's crypto suite

4.2.1.3 test with tls
4.2.1.3.1 new EnrollmentRequest
4.2.1.3.2 set enrollment request with host,profile
4.2.1.3.3 call HFCAClient's enroll with name & secret & enrollmentrequest
4.2.1.3.4 get Enrollment from last step
4.2.1.3.5 get tls cert pem and tls key pem from enrollment
4.2.1.3.6 new client TLS properties
4.2.1.3.7 store tlskeypem tlscertpem with the sample org

4.2.1.4 check if ca if connected, get ca info
4.2.1.5 get ca name
4.2.1.6 get sample user admin from store for the org
4.2.1.7 Preregistered admin only needs to be enrolled with Fabric caClien
4.2.1.8 call ca.enroll with admin name and password to get enrollment
4.2.1.9 set admin with this enrollment
4.2.1.10 set admin to sample org
4.2.1.11 get normal user from store

4.2.1.12 if user is not registerd
4.2.1.12.1 new regitrationRequest
4.2.1.12.2 call ca.register with request & admin user
4.2.1.12.3 set enrollmentSecret with returned value from ca.register

4.2.1.13 if user is not enrolled
4.2.1.13.1 call HFCAClient.enroll with user and its secrete
4.2.1.13.2 set user with enrollment from HFCAClient.enroll
4.2.1.13.3 add user to sample org

4.2.1.14 get peerOrgAdmin from path "../crypto-config/peerOrganizations/.."
4.2.1.15 set peerAdmin to sample org

4.3 fabric test
4.3.1 new HFClient
4.3.2 set HFClient crypto suite
4.3.3 get one sample org from store
4.3.4 construct channel

4.3.4.1 channel name,sample org
4.3.4.2 call HFClient.setUserContext with peerAdmin from sample org
4.3.4.3 for every order from sample org

4.2.4.3.1 get orderer properties from config
4.2.4.3.2 put property: keepAliveTime
4.2.4.3.2 put property: keepAliveTimeout
4.2.4.3.2 put property: keepAliveTimeWithoutCal
4.2.4.3.3 put property: clientTLSProperties
4.2.4.3.4 call HFClient.newOrderer with name,location and properties
4.2.4.3.5 save orderer to orderer list

4.3.4.4 create channel
4.3.4.4.1 pick the first orderer in orderder list
4.3.4.4.2 new ChannelConfiguration with file *.tx
4.3.4.4.3 call HFClient.newChannel to create channel with name,orderer,channelconfig,channelconfig signature
4.3.4.4.4 for every peer in sample org

4.3.4.4.4.1 set peer properties with TLSProperties,maxInboundMessageSize
4.3.4.4.4.2 call HFClient.newPeer with name,location,properties to create peer
4.3.4.4.4.3 call Channel.joinPeer to have all peers join in channel
4.3.4.4.4.4 call Channel.addOrderer to have all orderer join in channel
4.3.4.4.4.5 call Channel.addEventHub to have all event hub join in channel
4.3.4.4.4.6 call Channel.initialize() to initialize
4.3.4.4.4.7 get bytes from Channel.serializeChannel()
4.3.4.4.4.8 call Channel shutdown
4.3.4.4.4.9 call HFClient.deserializeChannel with bytes to initialize a channel

4.3.4.5 save channel to store

4.3.4.6 run channel test with HFClient,channel,sample org
4.3.4.6.1 new class for event capture with handle,blockevent,ChaincodeEvent
4.3.4.6.2 call channel.registerChaincodeEventListner to save event to queue
4.3.4.6.3 new ChaincodeID with name & version
4.3.4.6.4 set chaincodeID with path
4.3.4.6.5 build chaincode

4.3.4.6.6 install chaincode
4.3.4.6.6.1 HFClient set userContext with peerAdmin from org
4.3.4.6.6.2 call HFClient.newInstallProposalRequest()
4.3.4.6.6.3 setChaincodeID to installProposalRequest
4.3.4.6.6.4 setChaincodeSourceLocation from local directory
4.3.4.6.6.5 or setChaincodeInputStream from
4.3.4.6.6.6 setChaincodeVersion to installProposalRequest
4.3.4.6.6.7 setChaincodeLanguage to installProposalRequest

4.3.4.6.7 only a client from the same org as the peer can issue an install request
4.3.4.6.7.1 get all peers from channel
4.3.4.6.7.2 call HFClient.sendInstallProposal with peers & installProposalRequest
4.3.4.6.7.3 check all responses for sendInstallProposal

4.3.4.6.8 Instantiate chaincode.
4.3.4.6.8.1 InstantiateProposalRequest from HFClient.newInstantiationProposalRequest()
4.3.4.6.8.2 set some properties for InstantiateProposalRequest
4.3.4.6.8.3 set chaincodeID, chaincodeLanguage
4.3.4.6.8.4 set function to execute
4.3.4.6.8.5 set function arguments
4.3.4.6.8.6 set method,HyperLedgerFabric to map
4.3.4.6.8.7 call setTransientMap of InstantiateProposalRequest
4.3.4.6.8.8 new ChaincodeEndorsementPolicy from YamlFile
4.3.4.6.8.9 set setChaincodeEndorsementPolicy for InstantiateProposalRequest
4.3.4.6.8.10 use channel created before to send above proposal to all peers
4.3.4.6.8.11 check all proposalResponse from above results

4.3.4.6.9
//Specify what events should complete the interest in this transaction. This is the default
// for all to complete. It's possible to specify many different combinations like
//any from a group, all from one group and just one from another or even None(NOfEvents.createNoEvents).
4.3.4.6.9.1 create NOfEvents
4.3.4.6.9.2 add peers to Channel.NOfEvents
4.3.4.6.9.3 add eventhubs of channel to Channel.NOfEvents

4.3.4.6.10 send transaction
4.3.4.6.10.1 use channel to send transaction
4.3.4.6.10.2 set user context,orderers,nOfEvents and so one
4.3.4.6.10.3 watch transaction event
4.3.4.6.10.3.1 get block event from transaction event
4.3.4.6.10.3.2 get block from block event
4.3.4.6.10.3.3 get ChaincodeID, channel's name

4.3.4.6.11 HFClient.setUserContext with TESTUSER_1
4.3.4.6.11.1 send transaction proposal to all peers
4.3.4.6.11.2 new TransactionProposalRequest
4.3.4.6.11.3 set chaincodeID created above
4.3.4.6.11.4 set chaincode language
4.3.4.6.11.5 set function defined in chaincode
4.3.4.6.11.6 set arguments
4.3.4.6.11.7 set transient map to TransactionProposalRequest
4.3.4.6.11.8 use channel to send transactionProposal to all peers
4.3.4.6.11.9 check all responses from HFClient.sendTransactionProposal

4.3.4.6.12 resolve the ProposalResponse from HFClient.sendTransactionProposal
4.3.4.6.12.1 get message from ProposalResponse
4.3.4.6.12.2 check if isVerified
4.3.4.6.12.3 get chaincode action response payload
4.3.4.6.12.4 getChaincodeActionResponseStatus from ProposalResponse
4.3.4.6.12.5 getChaincodeActionResponseReadWriteSetInfo from ProposalResponse
4.3.4.6.12.6 getNsRwsetCount
4.3.4.6.12.7 getChaincodeID from ProposalResponse
4.3.4.6.12.8 getPath from chaincode
4.3.4.6.12.9 getName & getVersion from chaincode

4.3.4.6.13 send transaction to orderer
4.3.4.6.13.1 use channel created before to send transaction with result from above

4.3.4.6.14 send query proposal to all peers in transactionEvent watcher
4.3.4.6.14.1 new QueryByChaincodeRequest from HFClient
4.3.4.6.14.2 set arguments & function & chaincodeID
4.3.4.6.14.3 set transientMap
4.3.4.6.14.4 use channel to queryByChaincode from all peers
4.3.4.6.14.5 check all ProposalResponse from queryByChaincode
4.3.4.6.14.6 proposalResponse has isVerified(),getStatus(),getPeer(),getMessage(),getPayload()

4.3.4.6.15 sendTransactionProposal in exceptional wathcer
4.3.4.6.15.1 get TransactionEventException from event e

4.3.5 Channel queries
4.3.5.1 get Blockchaininfo from Channel.queryBlockchainInfo()
4.3.5.2 get Height from Blockchaininfo
4.3.5.3 getCurrentBlockHash() from Blockchaininfo
4.3.5.4 getPreviousBlockHash() from Blockchaininfo
4.3.5.5 get BlockInfo

4.3.5.5.1 BlockInfo from Channel.queryBlockByNumber
4.3.5.5.1.1 get Previous Hash from BlockInfo retured from above
4.3.5.5.1.2 get BlockNumber from BlockInfo

4.3.5.5.2 BlockInfo from Channel.queryBlockByHash
4.3.5.5.2.1 get Previous Hash
4.3.5.5.2.2 get block number

4.3.5.5.3 BlockInfo from Channel.queryBlockByTransactionID
4.3.5.5.3.1 get block number
4.3.5.5.3.2 get Previous Hash

4.3.5.5.4 TransactionInfo from Channel.queryTransactionByID()
4.3.5.5.4.1 get TransactionID
4.3.5.5.4.2 getValidationCode and its number

原文地址:https://www.cnblogs.com/iiiDragon/p/8805892.html