Documentation ¶
Index ¶
- Variables
- func SignECDSA(k *ecdsa.PrivateKey, digest []byte) (signature []byte, err error)
- type MockEndorserServer
- type MockPeer
- func (p *MockPeer) EnrollmentCertificate() *pem.Block
- func (p *MockPeer) MSPID() string
- func (p MockPeer) Name() string
- func (p *MockPeer) ProcessTransactionProposal(tp fabApi.TransactionProposal, funcName []byte) (*fabApi.TransactionProposalResponse, error)
- func (p *MockPeer) Roles() []string
- func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block)
- func (p *MockPeer) SetMSPID(mspID string)
- func (p *MockPeer) SetName(name string)
- func (p *MockPeer) SetRoles(roles []string)
- func (p *MockPeer) URL() string
- type MockProviderFactory
Constants ¶
This section is empty.
Variables ¶
var CertPem = `` /* 768-byte string literal not displayed */
CertPem certificate
var KeyPem = []byte(`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICfXQtVmdQAlp/l9umWJqCXNTDurmciDNmGHPpxHwUK/oAoGCCqGSM49
AwEHoUQDQgAECb7YJmFuaycD4cpDKdcrPt9Vm+/CW/8N02Dcx2DuUhw/bPRvTv94
BnnRyF0k1yM0B39ACP+aYYbh05t6jihMoQ==
-----END EC PRIVATE KEY-----`)
KeyPem ec private key
var RootCA = `` /* 732-byte string literal not displayed */
RootCA ca
Functions ¶
Types ¶
type MockEndorserServer ¶
type MockEndorserServer struct { RequestCount int LastRequest *pb.SignedProposal // contains filtered or unexported fields }
MockEndorserServer mock endoreser server to process endorsement proposals
func StartEndorserServer ¶
func StartEndorserServer(endorserTestURL string) *MockEndorserServer
StartEndorserServer starts mock server for unit testing purpose
func (*MockEndorserServer) GetMockPeer ¶
func (m *MockEndorserServer) GetMockPeer() *MockPeer
GetMockPeer will return the mock endorser's mock peer in a thread safe way
func (*MockEndorserServer) ProcessProposal ¶
func (m *MockEndorserServer) ProcessProposal(context context.Context, proposal *pb.SignedProposal) (*pb.ProposalResponse, error)
ProcessProposal mock implementation that returns success if error is not set error if it is
func (*MockEndorserServer) SetMockPeer ¶
func (m *MockEndorserServer) SetMockPeer(mPeer *MockPeer)
SetMockPeer will write the mock endorser's mock peer in a thread safe way
type MockPeer ¶
type MockPeer struct { RWLock *sync.RWMutex Error error MockName string MockURL string MockRoles []string MockCert *pem.Block Payload map[string][]byte ResponseMessage string MockMSP string Status int32 ProcessProposalCalls int Endorser []byte KVWrite bool }
MockPeer is a mock fabricsdk.Peer.
func NewMockPeer ¶
NewMockPeer creates basic mock peer
func (*MockPeer) EnrollmentCertificate ¶
EnrollmentCertificate returns the mock peer's mock enrollment certificate
func (*MockPeer) ProcessTransactionProposal ¶
func (p *MockPeer) ProcessTransactionProposal(tp fabApi.TransactionProposal, funcName []byte) (*fabApi.TransactionProposalResponse, error)
ProcessTransactionProposal does not send anything anywhere but returns an empty mock ProposalResponse
func (*MockPeer) SetEnrollmentCertificate ¶
SetEnrollmentCertificate sets the mock peer's mock enrollment certificate
type MockProviderFactory ¶ added in v0.2.0
type MockProviderFactory struct { defsvc.ProviderFactory EventService fabApi.EventService }
MockProviderFactory event out the CHannel Provider
func (*MockProviderFactory) CreateChannelProvider ¶ added in v0.2.0
func (f *MockProviderFactory) CreateChannelProvider(config fabApi.EndpointConfig) (fabApi.ChannelProvider, error)
CreateChannelProvider creates a mock ChannelProvider