mocks

package
v0.0.0-...-523a819 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockRecv

mock recv mock for the recv函数

Types

type MockAtomicBroadcastClient

type MockAtomicBroadcastClient struct {
	BD *MockBlocksDeliverer
}

func (*MockAtomicBroadcastClient) Broadcast

func (*MockAtomicBroadcastClient) Deliver

type MockBlocksDeliverer

type MockBlocksDeliverer struct {
	DisconnectCalled           chan struct{}
	DisconnectAndDisableCalled chan struct{}
	CloseCalled                chan struct{}
	Pos                        uint64
	grpc.ClientStream

	MockRecv func(mock *MockBlocksDeliverer) (*orderer.DeliverResponse, error)
	// contains filtered or unexported fields
}

要初始化的BlocksDeliverer接口的Mocking结构 块提供程序实现

func (*MockBlocksDeliverer) Close

func (mock *MockBlocksDeliverer) Close()

func (*MockBlocksDeliverer) Disconnect

func (mock *MockBlocksDeliverer) Disconnect(disableEndpoint bool)

func (*MockBlocksDeliverer) GetEndpoints

func (mock *MockBlocksDeliverer) GetEndpoints() []string

func (*MockBlocksDeliverer) Recv

recv从订购服务获取响应,当前模拟返回 只有一个响应带有空块。

func (*MockBlocksDeliverer) RecvCount

func (mock *MockBlocksDeliverer) RecvCount() int32

recvcount返回调用recv的次数。

func (*MockBlocksDeliverer) Send

func (mock *MockBlocksDeliverer) Send(env *common.Envelope) error

send发送信封并请求订购服务块 现在被嘲笑,什么都不做

func (*MockBlocksDeliverer) UpdateEndpoints

func (mock *MockBlocksDeliverer) UpdateEndpoints(endpoints []string)

type MockGossipServiceAdapter

type MockGossipServiceAdapter struct {
	GossipBlockDisseminations chan uint64
	// contains filtered or unexported fields
}

用于初始化八卦服务的MockgossipsServiceAdapter模拟结构 块提供程序实现并断言数字 使用了个函数调用。

func (*MockGossipServiceAdapter) AddPayload

func (mock *MockGossipServiceAdapter) AddPayload(chainID string, payload *gossip_proto.Payload) error

addPayload将八卦负载添加到本地状态传输缓冲区

func (*MockGossipServiceAdapter) AddPayloadCount

func (mock *MockGossipServiceAdapter) AddPayloadCount() int32

addpayloadcount返回调用recv的次数。

func (*MockGossipServiceAdapter) Gossip

向所有同龄人传递八卦信息

func (*MockGossipServiceAdapter) PeersOfChannel

peersofchannel返回具有参与给定通道的对等方的切片

type MockLedgerInfo

type MockLedgerInfo struct {
	Height uint64
}

mockledgerinfo需要的ledgerinfo接口的mocking实现 用于测试初始化

func (*MockLedgerInfo) LedgerHeight

func (li *MockLedgerInfo) LedgerHeight() (uint64, error)

LedgerHeight将模拟值返回到分类帐高度

type Orderer

type Orderer struct {
	net.Listener
	*grpc.Server
	// contains filtered or unexported fields
}

func NewOrderer

func NewOrderer(port int, t *testing.T) *Orderer

func (*Orderer) Broadcast

func (*Orderer) ConnCount

func (o *Orderer) ConnCount() int

func (*Orderer) Deliver

func (*Orderer) Fail

func (o *Orderer) Fail()

func (*Orderer) Resurrect

func (o *Orderer) Resurrect()

func (*Orderer) SendBlock

func (o *Orderer) SendBlock(seq uint64)

func (*Orderer) SetNextExpectedSeek

func (o *Orderer) SetNextExpectedSeek(seq uint64)

func (*Orderer) Shutdown

func (o *Orderer) Shutdown()

Jump to

Keyboard shortcuts

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