mock

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2020 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))
}

CacherStub -

func (*CacherStub) Clear

func (cs *CacherStub) Clear()

Clear -

func (*CacherStub) Get

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

Get -

func (*CacherStub) Has

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

Has -

func (*CacherStub) HasOrAdd

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

HasOrAdd -

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

Keys -

func (*CacherStub) Len

func (cs *CacherStub) Len() int

Len -

func (*CacherStub) MaxSize

func (cs *CacherStub) MaxSize() int

MaxSize -

func (*CacherStub) Peek

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

Peek -

func (*CacherStub) Put

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

Put -

func (*CacherStub) RegisterHandler

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

RegisterHandler -

func (*CacherStub) Remove

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

Remove -

func (*CacherStub) RemoveOldest

func (cs *CacherStub) RemoveOldest()

RemoveOldest -

type Facade

type Facade struct {
	Running                           bool
	ShouldErrorStart                  bool
	ShouldErrorStop                   bool
	TpsBenchmarkHandler               func() *statistics.TpsBenchmark
	GetHeartbeatsHandler              func() ([]heartbeat.PubKeyHeartbeat, error)
	BalanceHandler                    func(string) (*big.Int, error)
	GetAccountHandler                 func(address string) (state.UserAccountHandler, error)
	GenerateTransactionHandler        func(sender string, receiver string, value *big.Int, code string) (*transaction.Transaction, error)
	GetTransactionHandler             func(hash string) (*transaction.Transaction, error)
	CreateTransactionHandler          func(nonce uint64, value string, receiverHex string, senderHex string, gasPrice uint64, gasLimit uint64, data []byte, signatureHex string) (*transaction.Transaction, []byte, error)
	ValidateTransactionHandler        func(tx *transaction.Transaction) error
	SendBulkTransactionsHandler       func(txs []*transaction.Transaction) (uint64, error)
	ExecuteSCQueryHandler             func(query *process.SCQuery) (*vmcommon.VMOutput, error)
	StatusMetricsHandler              func() external.StatusMetricsHandler
	ValidatorStatisticsHandler        func() (map[string]*state.ValidatorApiResponse, error)
	ComputeTransactionGasLimitHandler func(tx *transaction.Transaction) (uint64, error)
}

Facade is the mock implementation of a node router handler

func (*Facade) ComputeTransactionGasLimit

func (f *Facade) ComputeTransactionGasLimit(tx *transaction.Transaction) (uint64, error)

ComputeTransactionGasLimit --

func (*Facade) CreateTransaction

func (f *Facade) CreateTransaction(
	nonce uint64,
	value string,
	receiverHex string,
	senderHex string,
	gasPrice uint64,
	gasLimit uint64,
	data []byte,
	signatureHex string,
) (*transaction.Transaction, []byte, 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) 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.UserAccountHandler, 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) GetHeartbeats

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

GetHeartbeats returns the slice of heartbeat info

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) PprofEnabled

func (f *Facade) PprofEnabled() bool

PprofEnabled -

func (*Facade) RestAPIServerDebugMode

func (f *Facade) RestAPIServerDebugMode() bool

RestAPIServerDebugMode -

func (*Facade) RestApiInterface

func (f *Facade) RestApiInterface() string

RestApiInterface -

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) 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

func (*Facade) ValidateTransaction

func (f *Facade) ValidateTransaction(tx *transaction.Transaction) error

ValidateTransaction --

func (*Facade) ValidatorStatisticsApi

func (f *Facade) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)

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

type LoggerStub

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

LoggerStub -

func (*LoggerStub) Debug

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

Debug -

func (*LoggerStub) Error

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

Error -

func (*LoggerStub) Info

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

Info -

func (*LoggerStub) IsInterfaceNil

func (l *LoggerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*LoggerStub) LogIfError

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

LogIfError -

func (*LoggerStub) SetLevel

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

SetLevel -

func (*LoggerStub) Trace

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

Trace -

func (*LoggerStub) Warn

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

Warn -

type MarshalizerStub

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

MarshalizerStub -

func (*MarshalizerStub) IsInterfaceNil

func (ms *MarshalizerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MarshalizerStub) Marshal

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

Marshal -

func (*MarshalizerStub) Unmarshal

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

Unmarshal -

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
}

WsConnStub -

func (*WsConnStub) Close

func (wcs *WsConnStub) Close() error

Close -

func (*WsConnStub) ReadMessage

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

ReadMessage -

func (*WsConnStub) SetCloseHandler

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

SetCloseHandler -

func (*WsConnStub) SetReadMessageHandler

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

SetReadMessageHandler -

func (*WsConnStub) SetWriteMessageHandler

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

SetWriteMessageHandler -

func (*WsConnStub) WriteMessage

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

WriteMessage -

Jump to

Keyboard shortcuts

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