fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/pkg/fab/events/deliverclient/mocks Index | Files

package mocks

import "github.com/hyperledger/fabric-sdk-go/pkg/fab/events/deliverclient/mocks"

Index

Package Files

mockconnection.go mockevents.go

Constants

const (
    // Connect is the Connect operation (used in the OperationMap)
    Connect clientmocks.Operation = "connect"

    // BadRequestResult indicates that the operation should use invalid seek info
    BadRequestResult clientmocks.Result = "bad-request"

    // ForbiddenResult indicates that the user does not have permission to perform the operation
    ForbiddenResult clientmocks.Result = "forbidden"
)

Variables

var BlockEventFactory = func(block servicemocks.Block, sourceURL string) servicemocks.BlockEvent {
    b, ok := block.(*servicemocks.BlockWrapper)
    if !ok {
        panic(fmt.Sprintf("Invalid block type: %T", block))
    }
    return NewBlockEvent(b.Block(), sourceURL)
}

BlockEventFactory creates block events

var ConnFactory = func(opts ...clientmocks.Opt) clientmocks.Connection {
    return NewConnection(opts...)
}

ConnFactory is a connection factory that creates mock Deliver connections

var FilteredBlockEventFactory = func(block servicemocks.Block, sourceURL string) servicemocks.BlockEvent {
    b, ok := block.(*servicemocks.FilteredBlockWrapper)
    if !ok {
        panic(fmt.Sprintf("Invalid block type: %T", block))
    }
    return NewFilteredBlockEvent(b.Block(), sourceURL)
}

FilteredBlockEventFactory creates filtered block events

func NewBlockEvent Uses

func NewBlockEvent(block *cb.Block, sourceURL string) *connection.Event

NewBlockEvent returns a new mock block event initialized with the given block

func NewFilteredBlockEvent Uses

func NewFilteredBlockEvent(fblock *pb.FilteredBlock, sourceURL string) *connection.Event

NewFilteredBlockEvent returns a new mock filtered block event initialized with the given filtered block

type MockConnection Uses

type MockConnection struct {
    clientmocks.MockConnection
}

MockConnection is a fake connection used for unit testing

func NewConnection Uses

func NewConnection(opts ...clientmocks.Opt) *MockConnection

NewConnection returns a new MockConnection using the given options

func (*MockConnection) Receive Uses

func (c *MockConnection) Receive(eventch chan<- interface{})

Receive implements the MockConnection interface

func (*MockConnection) Send Uses

func (c *MockConnection) Send(sinfo *ab.SeekInfo) error

Send mockcore sending seek info to the deliver server

Package mocks imports 8 packages (graph). Updated 2019-08-28. Refresh now. Tools for package owners.