mocks

package
v0.2.16-metrics Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CertPem = `` /* 768-byte string literal not displayed */

CertPem certificate

View Source
var KeyPem = []byte(`-----BEGIN EC PRIVATE KEY-----
MHcCAQEEICfXQtVmdQAlp/l9umWJqCXNTDurmciDNmGHPpxHwUK/oAoGCCqGSM49
AwEHoUQDQgAECb7YJmFuaycD4cpDKdcrPt9Vm+/CW/8N02Dcx2DuUhw/bPRvTv94
BnnRyF0k1yM0B39ACP+aYYbh05t6jihMoQ==
-----END EC PRIVATE KEY-----`)

KeyPem ec private key

View Source
var RootCA = `` /* 732-byte string literal not displayed */

RootCA ca

Functions

func SignECDSA

func SignECDSA(k *ecdsa.PrivateKey, digest []byte) (signature []byte, err error)

SignECDSA sign with ec key

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

func NewMockPeer(name string, url string) *MockPeer

NewMockPeer creates basic mock peer

func (*MockPeer) EnrollmentCertificate

func (p *MockPeer) EnrollmentCertificate() *pem.Block

EnrollmentCertificate returns the mock peer's mock enrollment certificate

func (*MockPeer) MSPID

func (p *MockPeer) MSPID() string

MSPID gets the Peer mspID.

func (MockPeer) Name

func (p MockPeer) Name() string

Name returns the mock peer's mock name

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) Roles

func (p *MockPeer) Roles() []string

Roles returns the mock peer's mock roles

func (*MockPeer) SetEnrollmentCertificate

func (p *MockPeer) SetEnrollmentCertificate(pem *pem.Block)

SetEnrollmentCertificate sets the mock peer's mock enrollment certificate

func (*MockPeer) SetMSPID

func (p *MockPeer) SetMSPID(mspID string)

SetMSPID sets the Peer mspID.

func (*MockPeer) SetName

func (p *MockPeer) SetName(name string)

SetName sets the mock peer's mock name

func (*MockPeer) SetRoles

func (p *MockPeer) SetRoles(roles []string)

SetRoles sets the mock peer's mock roles

func (*MockPeer) URL

func (p *MockPeer) URL() string

URL returns the mock peer's mock URL

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL