mock

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacherStub

type CacherStub struct {
	ClearCalled           func()
	PutCalled             func(key []byte, value interface{}) (evicted bool)
	GetCalled             func(key []byte) (value interface{}, ok bool)
	HasCalled             func(key []byte) bool
	PeekCalled            func(key []byte) (value interface{}, ok bool)
	HasOrAddCalled        func(key []byte, value interface{}) (ok, evicted bool)
	RemoveCalled          func(key []byte)
	RemoveOldestCalled    func()
	KeysCalled            func() [][]byte
	LenCalled             func() int
	MaxSizeCalled         func() int
	RegisterHandlerCalled func(func(key []byte))
}

func (*CacherStub) Clear

func (cs *CacherStub) Clear()

func (*CacherStub) Get

func (cs *CacherStub) Get(key []byte) (value interface{}, ok bool)

func (*CacherStub) Has

func (cs *CacherStub) Has(key []byte) bool

func (*CacherStub) HasOrAdd

func (cs *CacherStub) HasOrAdd(key []byte, value interface{}) (ok, evicted bool)

func (*CacherStub) IsInterfaceNil

func (cs *CacherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherStub) Keys

func (cs *CacherStub) Keys() [][]byte

func (*CacherStub) Len

func (cs *CacherStub) Len() int

func (*CacherStub) MaxSize

func (cs *CacherStub) MaxSize() int

func (*CacherStub) Peek

func (cs *CacherStub) Peek(key []byte) (value interface{}, ok bool)

func (*CacherStub) Put

func (cs *CacherStub) Put(key []byte, value interface{}) (evicted bool)

func (*CacherStub) RegisterHandler

func (cs *CacherStub) RegisterHandler(handler func(key []byte))

func (*CacherStub) Remove

func (cs *CacherStub) Remove(key []byte)

func (*CacherStub) RemoveOldest

func (cs *CacherStub) RemoveOldest()

type Facade

type Facade struct {
	Running                                        bool
	ShouldErrorStart                               bool
	ShouldErrorStop                                bool
	GetCurrentPublicKeyHandler                     func() string
	TpsBenchmarkHandler                            func() *statistics.TpsBenchmark
	GetHeartbeatsHandler                           func() ([]heartbeat.PubKeyHeartbeat, error)
	BalanceHandler                                 func(string) (*big.Int, error)
	GetAccountHandler                              func(address string) (*state.Account, error)
	GenerateTransactionHandler                     func(sender string, receiver string, value *big.Int, code string) (*transaction.Transaction, error)
	GetTransactionHandler                          func(hash string) (*transaction.Transaction, error)
	SendTransactionHandler                         func(nonce uint64, sender string, receiver string, value string, gasPrice uint64, gasLimit uint64, code string, signature []byte) (string, error)
	CreateTransactionHandler                       func(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64, gasLimit uint64, data string, signatureHex string, challenge string) (*transaction.Transaction, error)
	SendBulkTransactionsHandler                    func(txs []*transaction.Transaction) (uint64, error)
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	ExecuteSCQueryHandler                          func(query *process.SCQuery) (*vmcommon.VMOutput, error)
	StatusMetricsHandler                           func() external.StatusMetricsHandler
}

Facade is the mock implementation of a node router handler

func (*Facade) CreateTransaction

func (f *Facade) CreateTransaction(
	nonce uint64,
	value string,
	receiverHex string,
	senderHex string,
	gasPrice uint64,
	gasLimit uint64,
	data string,
	signatureHex string,
	challenge string,
) (*transaction.Transaction, error)

CreateTransaction is mock implementation of a handler's CreateTransaction method

func (*Facade) ExecuteSCQuery

func (f *Facade) ExecuteSCQuery(query *process.SCQuery) (*vmcommon.VMOutput, error)

ExecuteSCQuery is a mock implementation.

func (*Facade) GenerateAndSendBulkTransactions added in v1.0.3

func (f *Facade) GenerateAndSendBulkTransactions(destination string, value *big.Int, nrTransactions uint64) error

GenerateAndSendBulkTransactions is the mock implementation of a handler's GenerateAndSendBulkTransactions method

func (*Facade) GenerateAndSendBulkTransactionsOneByOne added in v1.0.3

func (f *Facade) GenerateAndSendBulkTransactionsOneByOne(destination string, value *big.Int, nrTransactions uint64) error

GenerateAndSendBulkTransactionsOneByOne is the mock implementation of a handler's GenerateAndSendBulkTransactionsOneByOne method

func (*Facade) GenerateTransaction

func (f *Facade) GenerateTransaction(sender string, receiver string, value *big.Int,
	code string) (*transaction.Transaction, error)

GenerateTransaction is the mock implementation of a handler's GenerateTransaction method

func (*Facade) GetAccount

func (f *Facade) GetAccount(address string) (*state.Account, error)

GetAccount is the mock implementation of a handler's GetAccount method

func (*Facade) GetBalance

func (f *Facade) GetBalance(address string) (*big.Int, error)

GetBalance is the mock implementation of a handler's GetBalance method

func (*Facade) GetCurrentPublicKey added in v1.0.3

func (f *Facade) GetCurrentPublicKey() string

GetCurrentPublicKey is the mock implementation of a handler's StopNode method

func (*Facade) GetHeartbeats

func (f *Facade) GetHeartbeats() ([]heartbeat.PubKeyHeartbeat, error)

func (*Facade) GetTransaction

func (f *Facade) GetTransaction(hash string) (*transaction.Transaction, error)

GetTransaction is the mock implementation of a handler's GetTransaction method

func (*Facade) IsInterfaceNil

func (f *Facade) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Facade) IsNodeRunning

func (f *Facade) IsNodeRunning() bool

IsNodeRunning is the mock implementation of a handler's IsNodeRunning method

func (*Facade) SendBulkTransactions

func (f *Facade) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions is the mock implementation of a handler's SendBulkTransactions method

func (*Facade) SendTransaction added in v1.0.3

func (f *Facade) SendTransaction(nonce uint64, sender string, receiver string, value string, gasPrice uint64, gasLimit uint64, code string, signature []byte) (string, error)

SendTransaction is the mock implementation of a handler's SendTransaction method

func (*Facade) StartNode

func (f *Facade) StartNode() error

StartNode is the mock implementation of a handler's StartNode method

func (*Facade) StatusMetrics

func (f *Facade) StatusMetrics() external.StatusMetricsHandler

StatusMetrics is the mock implementation for the StatusMetrics

func (*Facade) StopNode

func (f *Facade) StopNode() error

StopNode is the mock implementation of a handler's StopNode method

func (*Facade) TpsBenchmark

func (f *Facade) TpsBenchmark() *statistics.TpsBenchmark

TpsBenchmark is the mock implementation for retreiving the TpsBenchmark

type LoggerStub

type LoggerStub struct {
	Log            func(level string, message string, args ...interface{})
	SetLevelCalled func(logLevel logger.LogLevel)
}

func (*LoggerStub) Debug

func (l *LoggerStub) Debug(message string, args ...interface{})

func (*LoggerStub) Error

func (l *LoggerStub) Error(message string, args ...interface{})

func (*LoggerStub) Info

func (l *LoggerStub) Info(message string, args ...interface{})

func (*LoggerStub) IsInterfaceNil

func (l *LoggerStub) IsInterfaceNil() bool

func (*LoggerStub) LogIfError

func (l *LoggerStub) LogIfError(err error, args ...interface{})

func (*LoggerStub) SetLevel

func (l *LoggerStub) SetLevel(logLevel logger.LogLevel)

func (*LoggerStub) Trace

func (l *LoggerStub) Trace(message string, args ...interface{})

func (*LoggerStub) Warn

func (l *LoggerStub) Warn(message string, args ...interface{})

type MarshalizerStub

type MarshalizerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

func (*MarshalizerStub) IsInterfaceNil

func (ms *MarshalizerStub) IsInterfaceNil() bool

func (*MarshalizerStub) Marshal

func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)

func (*MarshalizerStub) Unmarshal

func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error

type WrongFacade

type WrongFacade struct {
}

WrongFacade is a struct that can be used as a wrong implementation of the node router handler

type WsConnStub

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

func (*WsConnStub) Close

func (wcs *WsConnStub) Close() error

func (*WsConnStub) ReadMessage

func (wcs *WsConnStub) ReadMessage() (messageType int, p []byte, err error)

func (*WsConnStub) SetCloseHandler

func (wcs *WsConnStub) SetCloseHandler(f func() error)

func (*WsConnStub) SetReadMessageHandler

func (wcs *WsConnStub) SetReadMessageHandler(f func() (messageType int, p []byte, err error))

func (*WsConnStub) SetWriteMessageHandler

func (wcs *WsConnStub) SetWriteMessageHandler(f func(messageType int, data []byte) error)

func (*WsConnStub) WriteMessage

func (wcs *WsConnStub) WriteMessage(messageType int, data []byte) error

Jump to

Keyboard shortcuts

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