mocks

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

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

MockClient wrapper for client.Client which can be manipulated for desired results for tests

func GetNewClientWrapper

func GetNewClientWrapper(fcClient transactionsnapApi.Client) *MockClient

GetNewClientWrapper returns wrapper mock object of client

func (*MockClient) CommitTransaction

func (c *MockClient) CommitTransaction(channel sdkApi.Channel, txres []*apitxn.TransactionProposalResponse, register bool) error

CommitTransaction submits the given endorsements on the specified channel for commit @param {Channel} channel on which the transaction is taking place @param {[]TransactionProposalResponse} responses from endorsers @param {bool} register for Tx event @returns {error} error, if any

func (*MockClient) EndorseTransaction

func (c *MockClient) EndorseTransaction(channel sdkApi.Channel, request *transactionsnapApi.EndorseTxRequest) (
	[]*apitxn.TransactionProposalResponse, error)

EndorseTransaction request endorsement from the peers on this channel for a transaction with the given parameters @param {Channel} channel on which we want to transact @param {EndorseTxRequest} request identifies the chaincode to invoke @returns {[]TransactionProposalResponse} responses from endorsers @returns {error} error, if any

func (*MockClient) GetChannel

func (c *MockClient) GetChannel(name string) (sdkApi.Channel, error)

GetChannel returns a channel object that has been added to the fabric client @param {string} name of the channel @returns {Channel} channel that was requested @returns {error} error, if any

func (*MockClient) GetConfig

func (c *MockClient) GetConfig() sdkConfigApi.Config

GetConfig get client config @returns {Config} config

func (*MockClient) GetEventHub

func (c *MockClient) GetEventHub() (sdkApi.EventHub, error)

GetEventHub returns the GetEventHub @returns {EventHub} EventHub @returns {error} error, if any

func (*MockClient) GetSelectionService

func (c *MockClient) GetSelectionService() transactionsnapApi.SelectionService

GetSelectionService returns the SelectionService

func (*MockClient) GetUser

func (c *MockClient) GetUser() sdkApi.User

GetUser returns the user from the client context @retruns {User} user

func (*MockClient) Hash

func (c *MockClient) Hash(message []byte) ([]byte, error)

Hash message @param {[]byte} message to hash @returns {[[]byte} hash @returns {error} error, if any

func (*MockClient) InitializeChannel

func (c *MockClient) InitializeChannel(channel sdkApi.Channel) error

InitializeChannel returns nil for tests assuming that give channel is already initialized @param {Channel} Channel that needs to be initialized @returns {error} error, if any

func (*MockClient) NewChannel

func (c *MockClient) NewChannel(name string) (sdkApi.Channel, error)

NewChannel registers a channel object with the fabric client this object represents a channel on the fabric network @param {string} name of the channel @returns {Channel} channel object @returns {error} error, if any

func (*MockClient) QueryChannels

func (c *MockClient) QueryChannels(peer sdkApi.Peer) ([]string, error)

QueryChannels joined by the given peer @param {Peer} The peer to query @returns {[]string} list of channels @returns {error} error, if any

func (*MockClient) SetSelectionService

func (c *MockClient) SetSelectionService(service transactionsnapApi.SelectionService)

SetSelectionService is used to inject a selection service for testing @param {SelectionService} SelectionService

func (*MockClient) VerifyTxnProposalSignature

func (c *MockClient) VerifyTxnProposalSignature(channel sdkApi.Channel, bytes []byte) error

VerifyTxnProposalSignature verify TxnProposalSignature against msp @param {Channel} channel on which the transaction is taking place @param {[]byte} Txn Proposal @returns {error} error, if any

type MockMembershipManager

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

MockMembershipManager implements mock membership manager

func NewMockMembershipManager

func NewMockMembershipManager(err error) *MockMembershipManager

NewMockMembershipManager creates new mock membership manager

func (*MockMembershipManager) Add

func (m *MockMembershipManager) Add(channelID string, peers ...api.ChannelPeer) *MockMembershipManager

Add adds peers for channel

func (*MockMembershipManager) GetPeersOfChannel

func (m *MockMembershipManager) GetPeersOfChannel(channelID string) api.ChannelMembership

GetPeersOfChannel is mock implementation of GetPeersOfChannel

type MockSelectionService

type MockSelectionService struct {
	TestPeer       api.PeerConfig
	TestEndorsers  []sdkApi.Peer
	InvalidChannel string
}

MockSelectionService type used in testing

func (*MockSelectionService) GetEndorsersForChaincode

func (m *MockSelectionService) GetEndorsersForChaincode(channelID string,
	peerFilter api.PeerFilter, chaincodeIDs ...string) ([]sdkApi.Peer, error)

GetEndorsersForChaincode return endorsers for chaincode

func (*MockSelectionService) GetPeerForEvents

func (m *MockSelectionService) GetPeerForEvents(channelID string) (*api.PeerConfig, error)

GetPeerForEvents get peers for events

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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