mocks

package
v0.4.33 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 43 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 NewMockSigningIdentity added in v0.4.4

func NewMockSigningIdentity() (msp.SigningIdentity, error)

NewMockSigningIdentity ...

func SignECDSA

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

SignECDSA sign with ec key

Types

type BlockBuilder added in v0.4.4

type BlockBuilder struct {
	// contains filtered or unexported fields
}

BlockBuilder builds a mock Block

func NewBlockBuilder added in v0.4.4

func NewBlockBuilder(channelID string, blockNum uint64) *BlockBuilder

NewBlockBuilder returns a new mock BlockBuilder

func (*BlockBuilder) Build added in v0.4.4

func (b *BlockBuilder) Build() *cb.Block

Build builds the block

func (*BlockBuilder) ConfigUpdate added in v0.4.4

func (b *BlockBuilder) ConfigUpdate() *ConfigUpdateBuilder

ConfigUpdate adds a config update

func (*BlockBuilder) Transaction added in v0.4.4

func (b *BlockBuilder) Transaction(txID string, validationCode pb.TxValidationCode) *TxBuilder

Transaction adds a new transaction

type CCActionBuilder added in v0.4.4

type CCActionBuilder struct {
	// contains filtered or unexported fields
}

CCActionBuilder builds a mock Chaincode Action

func NewCCActionBuilder added in v0.4.4

func NewCCActionBuilder(ccID, txID string) *CCActionBuilder

NewCCActionBuilder returns a new CCActionBuilder

func (*CCActionBuilder) Build added in v0.4.4

func (b *CCActionBuilder) Build() []byte

Build builds the chaincode action

func (*CCActionBuilder) ChaincodeEvent added in v0.4.4

func (b *CCActionBuilder) ChaincodeEvent(eventName string, payload []byte) *CCActionBuilder

ChaincodeEvent adds a chaincode event to the chaincode action

func (*CCActionBuilder) Collection added in v0.4.4

func (b *CCActionBuilder) Collection(coll string) *NamespaceRWSetBuilder

Collection starts a new collection read/write set

func (*CCActionBuilder) Delete added in v0.4.4

func (b *CCActionBuilder) Delete(key string) *CCActionBuilder

Delete adds a KV write (with delete=true) to the read/write set

func (*CCActionBuilder) Read added in v0.4.4

func (b *CCActionBuilder) Read(key string, version *kvrwset.Version) *CCActionBuilder

Read adds a KV read to the read/write set

func (*CCActionBuilder) Response added in v0.4.4

func (b *CCActionBuilder) Response(response *pb.Response) *CCActionBuilder

Response sets the chaincode response

func (*CCActionBuilder) Write added in v0.4.4

func (b *CCActionBuilder) Write(key string, value []byte) *CCActionBuilder

Write adds a KV write to the read/write set

type ChaincodeActionBuilder added in v0.4.4

type ChaincodeActionBuilder struct {
	// contains filtered or unexported fields
}

ChaincodeActionBuilder builds a mock ChaincodeAction

func NewChaincodeActionBuilder added in v0.4.4

func NewChaincodeActionBuilder() *ChaincodeActionBuilder

NewChaincodeActionBuilder returns a mock ChaincodeAction builder

func (*ChaincodeActionBuilder) Build added in v0.4.4

Build returns the ChaincodeAction

func (*ChaincodeActionBuilder) ChaincodeID added in v0.4.4

func (b *ChaincodeActionBuilder) ChaincodeID(name, path, version string) *ChaincodeActionBuilder

ChaincodeID sets the chaincode ID

func (*ChaincodeActionBuilder) Events added in v0.4.4

Events sets the results

func (*ChaincodeActionBuilder) Response added in v0.4.4

func (b *ChaincodeActionBuilder) Response(status int32, payload []byte, message string) *ChaincodeActionBuilder

Response sets the response

func (*ChaincodeActionBuilder) Results added in v0.4.4

Results returns a read-write set builder

type ChaincodeDataBuilder added in v0.4.4

type ChaincodeDataBuilder struct {
	// contains filtered or unexported fields
}

ChaincodeDataBuilder builds mock ChaincodeData

func NewChaincodeDataBuilder added in v0.4.4

func NewChaincodeDataBuilder() *ChaincodeDataBuilder

NewChaincodeDataBuilder returns a mock ChaincodeData builder

func (*ChaincodeDataBuilder) Build added in v0.4.4

Build returns the ChaincodeData

func (*ChaincodeDataBuilder) BuildBytes added in v0.4.4

func (b *ChaincodeDataBuilder) BuildBytes() []byte

BuildBytes returns the ChaincodeData bytes

func (*ChaincodeDataBuilder) Name added in v0.4.4

Name sets the chaincode name

func (*ChaincodeDataBuilder) Policy added in v0.4.4

Policy sets the chaincode policy

func (*ChaincodeDataBuilder) VSCC added in v0.4.4

VSCC sets the VSCC

func (*ChaincodeDataBuilder) Version added in v0.4.4

Version sets the chaincode version

type ChaincodeEventBuilder added in v0.4.4

type ChaincodeEventBuilder struct {
	// contains filtered or unexported fields
}

ChaincodeEventBuilder builds a mock ChaincodeAction

func NewChaincodeEventBuilder added in v0.4.4

func NewChaincodeEventBuilder() *ChaincodeEventBuilder

NewChaincodeEventBuilder returns a mock ChaincodeAction builder

func (*ChaincodeEventBuilder) Build added in v0.4.4

Build returns the ChaincodeEvent

func (*ChaincodeEventBuilder) BuildBytes added in v0.4.4

func (b *ChaincodeEventBuilder) BuildBytes() []byte

BuildBytes returns the ChaincodeEvent bytes

func (*ChaincodeEventBuilder) ChaincodeID added in v0.4.4

func (b *ChaincodeEventBuilder) ChaincodeID(value string) *ChaincodeEventBuilder

ChaincodeID sets the chaincode ID

func (*ChaincodeEventBuilder) EventName added in v0.4.4

func (b *ChaincodeEventBuilder) EventName(value string) *ChaincodeEventBuilder

EventName sets the event name

func (*ChaincodeEventBuilder) Payload added in v0.4.4

func (b *ChaincodeEventBuilder) Payload(value []byte) *ChaincodeEventBuilder

Payload sets the payload

func (*ChaincodeEventBuilder) TxID added in v0.4.4

TxID sets the transaction ID

type CollectionBuilder added in v0.4.4

type CollectionBuilder struct {
	// contains filtered or unexported fields
}

CollectionBuilder is a utility that builds a CollectionConfig and private data read/write sets for unit testing

func NewPvtReadWriteSetCollectionBuilder added in v0.4.4

func NewPvtReadWriteSetCollectionBuilder(name string) *CollectionBuilder

NewPvtReadWriteSetCollectionBuilder returns a new private read-write set collection builder

func (*CollectionBuilder) Build added in v0.4.4

Build builds the collection private read-write set

func (*CollectionBuilder) Delete added in v0.4.4

func (c *CollectionBuilder) Delete(key string) *CollectionBuilder

Delete adds a new write with 'IsDelete=true' to the collection

func (*CollectionBuilder) Read added in v0.4.4

func (c *CollectionBuilder) Read(key string, blockNum uint64, txIdx uint64) *CollectionBuilder

Read adds a new read to the collection

func (*CollectionBuilder) StaticConfig added in v0.4.4

func (c *CollectionBuilder) StaticConfig(policy string, requiredPeerCount, maximumPeerCount int32, btl uint64) *CollectionBuilder

StaticConfig sets the static collection config

func (*CollectionBuilder) TransientConfig added in v0.4.4

func (c *CollectionBuilder) TransientConfig(policy string, requiredPeerCount, maximumPeerCount int32, ttl string) *CollectionBuilder

TransientConfig sets the transient collection config

func (*CollectionBuilder) WithMarshalError added in v0.4.4

func (c *CollectionBuilder) WithMarshalError() *CollectionBuilder

WithMarshalError simulates a marshalling error

func (*CollectionBuilder) Write added in v0.4.4

func (c *CollectionBuilder) Write(key string, value []byte) *CollectionBuilder

Write adds a new write to the collection

type ConfigUpdateBuilder added in v0.4.4

type ConfigUpdateBuilder struct {
	// contains filtered or unexported fields
}

ConfigUpdateBuilder builds a mock config update envelope

func NewConfigUpdateBuilder added in v0.4.4

func NewConfigUpdateBuilder(channelID string) *ConfigUpdateBuilder

NewConfigUpdateBuilder returns a new mock ConfigUpdateBuilder

func (*ConfigUpdateBuilder) Build added in v0.4.4

func (b *ConfigUpdateBuilder) Build() []byte

Build builds a config update envelope

type EndorsementBuilder added in v0.4.4

type EndorsementBuilder struct {
	// contains filtered or unexported fields
}

EndorsementBuilder builds a mock ChaincodeAction

func NewEndorsementBuilder added in v0.4.4

func NewEndorsementBuilder() *EndorsementBuilder

NewEndorsementBuilder returns a mock ChaincodeAction builder

func (*EndorsementBuilder) Build added in v0.4.4

func (b *EndorsementBuilder) Build() *pb.Endorsement

Build returns the Endorsement

func (*EndorsementBuilder) Endorser added in v0.4.4

func (b *EndorsementBuilder) Endorser(value []byte) *EndorsementBuilder

Endorser sets the endorser

func (*EndorsementBuilder) Signature added in v0.4.4

func (b *EndorsementBuilder) Signature(value []byte) *EndorsementBuilder

Signature sets the signature

type Identity added in v0.4.4

type Identity struct {
	// contains filtered or unexported fields
}

Identity implements identity

func NewIdentity added in v0.4.4

func NewIdentity() *Identity

NewIdentity creates new mock identity

func (*Identity) Anonymous added in v0.4.4

func (id *Identity) Anonymous() bool

Anonymous ...

func (*Identity) ExpiresAt added in v0.4.4

func (id *Identity) ExpiresAt() time.Time

ExpiresAt returns the time at which the Identity expires.

func (*Identity) GetIdentifier added in v0.4.4

func (id *Identity) GetIdentifier() *msp.IdentityIdentifier

GetIdentifier returns the identifier (MSPID/IDID) for this instance

func (*Identity) GetMSPIdentifier added in v0.4.4

func (id *Identity) GetMSPIdentifier() string

GetMSPIdentifier returns the MSP identifier for this instance

func (*Identity) GetOrganizationalUnits added in v0.4.4

func (id *Identity) GetOrganizationalUnits() []*msp.OUIdentifier

GetOrganizationalUnits returns the OU for this instance

func (*Identity) SatisfiesPrincipal added in v0.4.4

func (id *Identity) SatisfiesPrincipal(principal *mp.MSPPrincipal) error

SatisfiesPrincipal returns null if this instance matches the supplied principal or an error otherwise

func (*Identity) Serialize added in v0.4.4

func (id *Identity) Serialize() ([]byte, error)

Serialize returns a byte array representation of this identity

func (*Identity) Validate added in v0.4.4

func (id *Identity) Validate() error

Validate returns nil if this instance is a valid identity or an error otherwise

func (*Identity) Verify added in v0.4.4

func (id *Identity) Verify(msg []byte, sig []byte) error

Verify checks against a signature and a message to determine whether this identity produced the signature; it returns nil if so or an error otherwise

func (*Identity) WithError added in v0.4.4

func (id *Identity) WithError(err error) *Identity

WithError injects an error

func (*Identity) WithMSPID added in v0.4.4

func (id *Identity) WithMSPID(mspID string) *Identity

WithMSPID sets the identifier

type MSP added in v0.4.4

type MSP struct {
	// contains filtered or unexported fields
}

MSP implements mock msp

func NewMSP added in v0.4.4

func NewMSP() *MSP

NewMSP creates mock msp

func (*MSP) DeserializeIdentity added in v0.4.4

func (m *MSP) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error)

DeserializeIdentity mockcore deserialize identity

func (*MSP) GetDefaultSigningIdentity added in v0.4.4

func (m *MSP) GetDefaultSigningIdentity() (msp.SigningIdentity, error)

GetDefaultSigningIdentity returns the default signing identity

func (*MSP) GetIdentifier added in v0.4.4

func (m *MSP) GetIdentifier() (string, error)

GetIdentifier returns the provider identifier

func (*MSP) GetMSPs added in v0.4.4

func (m *MSP) GetMSPs() (map[string]msp.MSP, error)

GetMSPs Provides a list of Membership Service providers

func (*MSP) GetSigningIdentity added in v0.4.4

func (m *MSP) GetSigningIdentity(identifier *msp.IdentityIdentifier) (msp.SigningIdentity, error)

GetSigningIdentity returns a signing identity corresponding to the provided identifier

func (*MSP) GetTLSIntermediateCerts added in v0.4.4

func (m *MSP) GetTLSIntermediateCerts() [][]byte

GetTLSIntermediateCerts returns the TLS intermediate root certificates for this MSP

func (*MSP) GetTLSRootCerts added in v0.4.4

func (m *MSP) GetTLSRootCerts() [][]byte

GetTLSRootCerts returns the TLS root certificates for this MSP

func (*MSP) GetType added in v0.4.4

func (m *MSP) GetType() msp.ProviderType

GetType returns the provider type

func (*MSP) GetVersion added in v0.4.4

func (m *MSP) GetVersion() msp.MSPVersion

GetVersion returns the version of this MSP

func (*MSP) IsWellFormed added in v0.4.4

func (m *MSP) IsWellFormed(identity *mp.SerializedIdentity) error

IsWellFormed checks if the given identity can be deserialized into its provider-specific form

func (*MSP) SatisfiesPrincipal added in v0.4.4

func (m *MSP) SatisfiesPrincipal(id msp.Identity, principal *mp.MSPPrincipal) error

SatisfiesPrincipal checks whether the identity matches the description supplied in MSPPrincipal.

func (*MSP) Setup added in v0.4.4

func (m *MSP) Setup(config *mp.MSPConfig) error

Setup the MSP instance according to configuration information

func (*MSP) Validate added in v0.4.4

func (m *MSP) Validate(id msp.Identity) error

Validate checks whether the supplied identity is valid

func (*MSP) WithError added in v0.4.4

func (m *MSP) WithError(err error) *MSP

WithError injects an error

func (*MSP) WithIdentity added in v0.4.4

func (m *MSP) WithIdentity(identity msp.Identity) *MSP

WithIdentity injects an error on the deserialized identity

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, opts ...options.Opt) (fabApi.ChannelProvider, error)

CreateChannelProvider creates a mock ChannelProvider

type MockSigningIdentity added in v0.4.4

type MockSigningIdentity struct {
	// we embed everything from a base identity
	Identity

	// signer corresponds to the object that can produce signatures from this identity
	Signer crypto.Signer
}

MockSigningIdentity ...

func (*MockSigningIdentity) GetPublicVersion added in v0.4.4

func (id *MockSigningIdentity) GetPublicVersion() msp.Identity

GetPublicVersion ...

func (*MockSigningIdentity) Sign added in v0.4.4

func (id *MockSigningIdentity) Sign(msg []byte) ([]byte, error)

Sign produces a signature over msg, signed by this instance

type MockValidator added in v0.4.4

type MockValidator struct {
	Code pb.TxValidationCode
	Err  error
}

MockValidator is a mock proposal response validator

func NewMockValidator added in v0.4.4

func NewMockValidator() *MockValidator

NewMockValidator returns a mock validator

func (*MockValidator) ValidateProposalResponses added in v0.4.4

func (m *MockValidator) ValidateProposalResponses(proposal *pb.SignedProposal, proposalResponses []*pb.ProposalResponse) (pb.TxValidationCode, error)

ValidateProposalResponses returns a mock response for validation

type NamespaceBuilder added in v0.4.4

type NamespaceBuilder struct {
	// contains filtered or unexported fields
}

NamespaceBuilder is a utility that builds a CollectionPvtReadWriteSet and CollectionConfigPackage for unit testing

func NewNamespaceBuilder added in v0.4.4

func NewNamespaceBuilder(name string) *NamespaceBuilder

NewNamespaceBuilder returns a new namespace builder

func (*NamespaceBuilder) BuildCollectionConfig added in v0.4.4

func (b *NamespaceBuilder) BuildCollectionConfig() *common.CollectionConfigPackage

BuildCollectionConfig builds the collection config package for the namespace

func (*NamespaceBuilder) BuildCollectionHashedRWSets added in v0.4.4

func (b *NamespaceBuilder) BuildCollectionHashedRWSets() []*rwset.CollectionHashedReadWriteSet

BuildCollectionHashedRWSets builds the collection-hashed read-write sets

func (*NamespaceBuilder) BuildNSReadWriteSets added in v0.4.4

func (b *NamespaceBuilder) BuildNSReadWriteSets() []byte

BuildNSReadWriteSets builds the read-write sets

func (*NamespaceBuilder) BuildReadWriteSets added in v0.4.4

func (b *NamespaceBuilder) BuildReadWriteSets() []*rwset.CollectionPvtReadWriteSet

BuildReadWriteSets builds the collection read-write sets for the namespace

func (*NamespaceBuilder) Collection added in v0.4.4

func (b *NamespaceBuilder) Collection(name string) *CollectionBuilder

Collection adds a new collection

func (*NamespaceBuilder) Delete added in v0.4.4

func (b *NamespaceBuilder) Delete(key string) *NamespaceBuilder

Delete adds a new write with 'IsDelete=true' to the namespace

func (*NamespaceBuilder) Read added in v0.4.4

func (b *NamespaceBuilder) Read(key string, blockNum uint64, txIdx uint64) *NamespaceBuilder

Read adds a new read to the namespace

func (*NamespaceBuilder) WithMarshalError added in v0.4.4

func (b *NamespaceBuilder) WithMarshalError() *NamespaceBuilder

WithMarshalError simulates a marshalling error

func (*NamespaceBuilder) Write added in v0.4.4

func (b *NamespaceBuilder) Write(key string, value []byte) *NamespaceBuilder

Write adds a new write to the namespace

type NamespaceRWSetBuilder added in v0.4.4

type NamespaceRWSetBuilder struct {
	// contains filtered or unexported fields
}

NamespaceRWSetBuilder builds a mock read/write set for a given namespace

func NewNamespaceRWSetBuilder added in v0.4.4

func NewNamespaceRWSetBuilder(ns string) *NamespaceRWSetBuilder

NewNamespaceRWSetBuilder returns a new namespace read/write set builder

func (*NamespaceRWSetBuilder) Build added in v0.4.4

Build builds a namespace read/write set

func (*NamespaceRWSetBuilder) Delete added in v0.4.4

Delete adds a KV write (with delete=true) to the read/write set

func (*NamespaceRWSetBuilder) Read added in v0.4.4

Read adds a KV read to the read/write set

func (*NamespaceRWSetBuilder) Write added in v0.4.4

func (b *NamespaceRWSetBuilder) Write(key string, value []byte) *NamespaceRWSetBuilder

Write adds a KV write to the read/write set

type ProposalBuilder added in v0.4.4

type ProposalBuilder struct {
	// contains filtered or unexported fields
}

ProposalBuilder builds a mock signed proposal

func NewProposalBuilder added in v0.4.4

func NewProposalBuilder() *ProposalBuilder

NewProposalBuilder returns a mock proposal builder

func (*ProposalBuilder) Args added in v0.4.4

func (b *ProposalBuilder) Args(args ...[]byte) *ProposalBuilder

Args adds chaincode arguments

func (*ProposalBuilder) Build added in v0.4.4

func (b *ProposalBuilder) Build() *pb.SignedProposal

Build returns the signed proposal

func (*ProposalBuilder) ChaincodeID added in v0.4.4

func (b *ProposalBuilder) ChaincodeID(value string) *ProposalBuilder

ChaincodeID sets the chaincode ID for the proposal

func (*ProposalBuilder) ChannelID added in v0.4.4

func (b *ProposalBuilder) ChannelID(value string) *ProposalBuilder

ChannelID sets the channel ID for the proposal

func (*ProposalBuilder) MSPID added in v0.4.4

func (b *ProposalBuilder) MSPID(value string) *ProposalBuilder

MSPID sets the MSP ID of the creator

func (*ProposalBuilder) TransientArg added in v0.4.4

func (b *ProposalBuilder) TransientArg(key string, value []byte) *ProposalBuilder

TransientArg adds a transient key-value

type ProposalResponseBuilder added in v0.4.4

type ProposalResponseBuilder struct {
	// contains filtered or unexported fields
}

ProposalResponseBuilder builds a mock ProposalResponse

func NewProposalResponseBuilder added in v0.4.4

func NewProposalResponseBuilder() *ProposalResponseBuilder

NewProposalResponseBuilder returns a mock proposal response builder

func (*ProposalResponseBuilder) Build added in v0.4.4

Build returns a proposal response

func (*ProposalResponseBuilder) Endorsement added in v0.4.4

func (b *ProposalResponseBuilder) Endorsement() *EndorsementBuilder

Endorsement returns a new endorsement builder

func (*ProposalResponseBuilder) Payload added in v0.4.4

Payload returns a new response payload builder

func (*ProposalResponseBuilder) Response added in v0.4.4

Response returns a new response builder

func (*ProposalResponseBuilder) Timestamp added in v0.4.4

Timestamp sets the timestamp

func (*ProposalResponseBuilder) Version added in v0.4.4

Version sets the version

type ProposalResponsesBuilder added in v0.4.4

type ProposalResponsesBuilder struct {
	// contains filtered or unexported fields
}

ProposalResponsesBuilder builds a slice of mock ProposalResponse's

func NewProposalResponsesBuilder added in v0.4.4

func NewProposalResponsesBuilder() *ProposalResponsesBuilder

NewProposalResponsesBuilder returns a mock proposal responses builder

func (*ProposalResponsesBuilder) Build added in v0.4.4

Build returns a slice of mock ProposalResponse's

func (*ProposalResponsesBuilder) ProposalResponse added in v0.4.4

func (b *ProposalResponsesBuilder) ProposalResponse() *ProposalResponseBuilder

ProposalResponse adds a new proposal response

type PvtReadWriteSetBuilder added in v0.4.4

type PvtReadWriteSetBuilder struct {
	// contains filtered or unexported fields
}

PvtReadWriteSetBuilder is a utility that builds a TxPvtReadWriteSetWithConfigInfo for unit testing

func NewPvtReadWriteSetBuilder added in v0.4.4

func NewPvtReadWriteSetBuilder() *PvtReadWriteSetBuilder

NewPvtReadWriteSetBuilder returns a new PvtReadWriteSetBuilder

func (*PvtReadWriteSetBuilder) Build added in v0.4.4

Build builds a TxPvtReadWriteSetWithConfigInfo

func (*PvtReadWriteSetBuilder) BuildCollectionConfigs added in v0.4.4

func (b *PvtReadWriteSetBuilder) BuildCollectionConfigs() map[string]*common.CollectionConfigPackage

BuildCollectionConfigs builds the collection config package

func (*PvtReadWriteSetBuilder) BuildReadWriteSet added in v0.4.4

func (b *PvtReadWriteSetBuilder) BuildReadWriteSet() *rwset.TxPvtReadWriteSet

BuildReadWriteSet builds the private read-write sets

func (*PvtReadWriteSetBuilder) Namespace added in v0.4.4

func (b *PvtReadWriteSetBuilder) Namespace(name string) *NamespaceBuilder

Namespace returns a new NamespaceBuilder

type QueryExecutor added in v0.4.4

type QueryExecutor struct {
	// contains filtered or unexported fields
}

QueryExecutor is a mock query executor

func NewQueryExecutor added in v0.4.4

func NewQueryExecutor() *QueryExecutor

NewQueryExecutor returns a new mock query executor

func (*QueryExecutor) Done added in v0.4.4

func (m *QueryExecutor) Done()

Done does nothing

func (*QueryExecutor) ExecuteQuery added in v0.4.4

func (m *QueryExecutor) ExecuteQuery(namespace, query string) (commonledger.ResultsIterator, error)

ExecuteQuery is not currently implemented and will panic if called

func (*QueryExecutor) ExecuteQueryOnPrivateData added in v0.4.4

func (m *QueryExecutor) ExecuteQueryOnPrivateData(namespace, collection, query string) (commonledger.ResultsIterator, error)

ExecuteQueryOnPrivateData is not currently implemented and will panic if called

func (*QueryExecutor) ExecuteQueryWithMetadata added in v0.4.4

func (m *QueryExecutor) ExecuteQueryWithMetadata(namespace, query string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)

ExecuteQueryWithMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateData added in v0.4.4

func (m *QueryExecutor) GetPrivateData(namespace, collection, key string) ([]byte, error)

GetPrivateData returns the private data for the given namespace, collection, and key

func (*QueryExecutor) GetPrivateDataHash added in v0.4.4

func (m *QueryExecutor) GetPrivateDataHash(namespace, collection, key string) ([]byte, error)

GetPrivateDataHash is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMetadata added in v0.4.4

func (m *QueryExecutor) GetPrivateDataMetadata(namespace, collection, key string) (map[string][]byte, error)

GetPrivateDataMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMetadataByHash added in v0.4.4

func (m *QueryExecutor) GetPrivateDataMetadataByHash(namespace, collection string, keyhash []byte) (map[string][]byte, error)

GetPrivateDataMetadataByHash is not currently implemented and will panic if called

func (*QueryExecutor) GetPrivateDataMultipleKeys added in v0.4.4

func (m *QueryExecutor) GetPrivateDataMultipleKeys(namespace, collection string, keys []string) ([][]byte, error)

GetPrivateDataMultipleKeys returns the private data for the given namespace, collection, and keys

func (*QueryExecutor) GetPrivateDataRangeScanIterator added in v0.4.4

func (m *QueryExecutor) GetPrivateDataRangeScanIterator(namespace, collection, startKey, endKey string) (commonledger.ResultsIterator, error)

GetPrivateDataRangeScanIterator is not currently implemented and will panic if called

func (*QueryExecutor) GetState added in v0.4.4

func (m *QueryExecutor) GetState(namespace string, key string) ([]byte, error)

GetState returns the mock state for the given namespace and key

func (*QueryExecutor) GetStateMetadata added in v0.4.4

func (m *QueryExecutor) GetStateMetadata(namespace, key string) (map[string][]byte, error)

GetStateMetadata is not currently implemented and will panic if called

func (*QueryExecutor) GetStateMultipleKeys added in v0.4.4

func (m *QueryExecutor) GetStateMultipleKeys(namespace string, keys []string) ([][]byte, error)

GetStateMultipleKeys returns the mock state for the given namespace and keys

func (*QueryExecutor) GetStateRangeScanIterator added in v0.4.4

func (m *QueryExecutor) GetStateRangeScanIterator(namespace string, startKey string, endKey string) (commonledger.ResultsIterator, error)

GetStateRangeScanIterator is not currently implemented and will panic if called

func (*QueryExecutor) GetStateRangeScanIteratorWithMetadata added in v0.4.4

func (m *QueryExecutor) GetStateRangeScanIteratorWithMetadata(namespace string, startKey, endKey string, metadata map[string]interface{}) (ledger.QueryResultsIterator, error)

GetStateRangeScanIteratorWithMetadata is not currently implemented and will panic if called

func (*QueryExecutor) PrivateState added in v0.4.4

func (m *QueryExecutor) PrivateState(ns, collection, key string, value []byte) *QueryExecutor

PrivateState sets the private state

func (*QueryExecutor) State added in v0.4.4

func (m *QueryExecutor) State(ns, key string, value []byte) *QueryExecutor

State sets the state

func (*QueryExecutor) WithError added in v0.4.4

func (m *QueryExecutor) WithError(err error) *QueryExecutor

WithError injects an error to the mock executor

type ReadWriteSetBuilder added in v0.4.4

type ReadWriteSetBuilder struct {
	// contains filtered or unexported fields
}

ReadWriteSetBuilder is a utility that builds a TxReadWriteSet for unit testing

func NewReadWriteSetBuilder added in v0.4.4

func NewReadWriteSetBuilder() *ReadWriteSetBuilder

NewReadWriteSetBuilder returns a new ReadWriteSetBuilder

func (*ReadWriteSetBuilder) Build added in v0.4.4

Build builds the read-write sets

func (*ReadWriteSetBuilder) BuildBytes added in v0.4.4

func (b *ReadWriteSetBuilder) BuildBytes() []byte

BuildBytes builds the read-write set bytes

func (*ReadWriteSetBuilder) Namespace added in v0.4.4

func (b *ReadWriteSetBuilder) Namespace(name string) *NamespaceBuilder

Namespace returns a new NamespaceBuilder

type ResponseBuilder added in v0.4.4

type ResponseBuilder struct {
	// contains filtered or unexported fields
}

ResponseBuilder builds a mock Response

func NewResponseBuilder added in v0.4.4

func NewResponseBuilder() *ResponseBuilder

NewResponseBuilder returns a mock response builder

func (*ResponseBuilder) Build added in v0.4.4

func (b *ResponseBuilder) Build() *pb.Response

Build returns the response

func (*ResponseBuilder) Message added in v0.4.4

func (b *ResponseBuilder) Message(value string) *ResponseBuilder

Message sets the response message

func (*ResponseBuilder) Payload added in v0.4.4

func (b *ResponseBuilder) Payload(value []byte) *ResponseBuilder

Payload sets the response payload

func (*ResponseBuilder) Status added in v0.4.4

func (b *ResponseBuilder) Status(value int32) *ResponseBuilder

Status sets the response status code

type ResponsePayloadBuilder added in v0.4.4

type ResponsePayloadBuilder struct {
	// contains filtered or unexported fields
}

ResponsePayloadBuilder builds a mock Proposal Response Payload

func NewResponsePayloadBuilder added in v0.4.4

func NewResponsePayloadBuilder() *ResponsePayloadBuilder

NewResponsePayloadBuilder returns a mock Proposal Response Payload builder

func (*ResponsePayloadBuilder) Build added in v0.4.4

Build returns the proposal response payload

func (*ResponsePayloadBuilder) BuildBytes added in v0.4.4

func (b *ResponsePayloadBuilder) BuildBytes() []byte

BuildBytes returns the proposal response payload bytes

func (*ResponsePayloadBuilder) ChaincodeAction added in v0.4.4

func (b *ResponsePayloadBuilder) ChaincodeAction() *ChaincodeActionBuilder

ChaincodeAction returns a ChaincodeActionBuilder

func (*ResponsePayloadBuilder) ProposalHash added in v0.4.4

func (b *ResponsePayloadBuilder) ProposalHash(value []byte) *ResponsePayloadBuilder

ProposalHash sets the proposal hash

type TxBuilder added in v0.4.4

type TxBuilder struct {
	// contains filtered or unexported fields
}

TxBuilder builds a mock Transaction

func NewTxBuilder added in v0.4.4

func NewTxBuilder(channelID, txID string, validationCode pb.TxValidationCode) *TxBuilder

NewTxBuilder returns a new mock TxBuilder

func (*TxBuilder) Build added in v0.4.4

func (b *TxBuilder) Build() ([]byte, pb.TxValidationCode)

Build builds a transaction

func (*TxBuilder) ChaincodeAction added in v0.4.4

func (b *TxBuilder) ChaincodeAction(ccID string) *CCActionBuilder

ChaincodeAction adds a chaincode action to the transaction

Jump to

Keyboard shortcuts

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