mock

package
v0.0.0-...-c0a90d8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Code generated by mocker; DO NOT EDIT github.com/travisjeffery/mocker

Code generated by mocker; DO NOT EDIT github.com/travisjeffery/mocker

Code generated by mocker; DO NOT EDIT github.com/travisjeffery/mocker

Code generated by mocker; DO NOT EDIT github.com/travisjeffery/mocker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetrics

func NewMetrics() *jocko.Metrics

Types

type Broker

type Broker struct {
	// JoinFunc mocks the Join method.
	JoinFunc func(addr ...string) protocol.Error

	// RunFunc mocks the Run method.
	RunFunc func(in1 context.Context, in2 <-chan jocko.Request, in3 chan<- jocko.Response)

	// ShutdownFunc mocks the Shutdown method.
	ShutdownFunc func() error
	// contains filtered or unexported fields
}

Broker is a mock implementation of Broker.

    func TestSomethingThatUsesBroker(t *testing.T) {

        // make and configure a mocked Broker
        mockedBroker := &Broker{
            JoinFunc: func(addr ...string) protocol.Error {
	               panic("TODO: mock out the Join method")
            },
            RunFunc: func(in1 context.Context,in2 <-chan jocko.Request,in3 chan<- jocko.Response)  {
	               panic("TODO: mock out the Run method")
            },
            ShutdownFunc: func() error {
	               panic("TODO: mock out the Shutdown method")
            },
        }

        // TODO: use mockedBroker in code that requires Broker
        //       and then make assertions.

    }

func (*Broker) Join

func (mock *Broker) Join(addr ...string) protocol.Error

Join calls JoinFunc.

func (*Broker) JoinCalled

func (mock *Broker) JoinCalled() bool

JoinCalled returns true if at least one call was made to Join.

func (*Broker) JoinCalls

func (mock *Broker) JoinCalls() []struct {
	Addr []string
}

JoinCalls gets all the calls that were made to Join. Check the length with:

len(mockedBroker.JoinCalls())

func (*Broker) Reset

func (mock *Broker) Reset()

Reset resets the calls made to the mocked APIs.

func (*Broker) Run

func (mock *Broker) Run(in1 context.Context, in2 <-chan jocko.Request, in3 chan<- jocko.Response)

Run calls RunFunc.

func (*Broker) RunCalled

func (mock *Broker) RunCalled() bool

RunCalled returns true if at least one call was made to Run.

func (*Broker) RunCalls

func (mock *Broker) RunCalls() []struct {
	In1 context.Context
	In2 <-chan jocko.Request
	In3 chan<- jocko.Response
}

RunCalls gets all the calls that were made to Run. Check the length with:

len(mockedBroker.RunCalls())

func (*Broker) Shutdown

func (mock *Broker) Shutdown() error

Shutdown calls ShutdownFunc.

func (*Broker) ShutdownCalled

func (mock *Broker) ShutdownCalled() bool

ShutdownCalled returns true if at least one call was made to Shutdown.

func (*Broker) ShutdownCalls

func (mock *Broker) ShutdownCalls() []struct {
}

ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:

len(mockedBroker.ShutdownCalls())

type Client

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

Client for testing

func NewClient

func NewClient(msgCount int) *Client

NewClient is a client that fetches given number of msgs

func (*Client) CreateTopic

func (p *Client) CreateTopic(clientID string, createRequest *protocol.CreateTopicRequest) (*protocol.CreateTopicsResponse, error)

func (*Client) FetchMessages

func (p *Client) FetchMessages(clientID string, fetchRequest *protocol.FetchRequest) (*protocol.FetchResponses, error)

func (*Client) Messages

func (p *Client) Messages() [][]byte

type CommitLog

type CommitLog struct {
	// AppendFunc mocks the Append method.
	AppendFunc func(in1 []byte) (int64, error)

	// DeleteFunc mocks the Delete method.
	DeleteFunc func() error

	// NewReaderFunc mocks the NewReader method.
	NewReaderFunc func(offset int64, maxBytes int32) (io.Reader, error)

	// NewestOffsetFunc mocks the NewestOffset method.
	NewestOffsetFunc func() int64

	// OldestOffsetFunc mocks the OldestOffset method.
	OldestOffsetFunc func() int64

	// TruncateFunc mocks the Truncate method.
	TruncateFunc func(in1 int64) error
	// contains filtered or unexported fields
}

CommitLog is a mock implementation of CommitLog.

    func TestSomethingThatUsesCommitLog(t *testing.T) {

        // make and configure a mocked CommitLog
        mockedCommitLog := &CommitLog{
            AppendFunc: func(in1 []byte) (int64, error) {
	               panic("TODO: mock out the Append method")
            },
            DeleteFunc: func() error {
	               panic("TODO: mock out the Delete method")
            },
            NewReaderFunc: func(offset int64,maxBytes int32) (io.Reader, error) {
	               panic("TODO: mock out the NewReader method")
            },
            NewestOffsetFunc: func() int64 {
	               panic("TODO: mock out the NewestOffset method")
            },
            OldestOffsetFunc: func() int64 {
	               panic("TODO: mock out the OldestOffset method")
            },
            TruncateFunc: func(in1 int64) error {
	               panic("TODO: mock out the Truncate method")
            },
        }

        // TODO: use mockedCommitLog in code that requires CommitLog
        //       and then make assertions.

    }

func (*CommitLog) Append

func (mock *CommitLog) Append(in1 []byte) (int64, error)

Append calls AppendFunc.

func (*CommitLog) AppendCalled

func (mock *CommitLog) AppendCalled() bool

AppendCalled returns true if at least one call was made to Append.

func (*CommitLog) AppendCalls

func (mock *CommitLog) AppendCalls() []struct {
	In1 []byte
}

AppendCalls gets all the calls that were made to Append. Check the length with:

len(mockedCommitLog.AppendCalls())

func (*CommitLog) Delete

func (mock *CommitLog) Delete() error

Delete calls DeleteFunc.

func (*CommitLog) DeleteCalled

func (mock *CommitLog) DeleteCalled() bool

DeleteCalled returns true if at least one call was made to Delete.

func (*CommitLog) DeleteCalls

func (mock *CommitLog) DeleteCalls() []struct {
}

DeleteCalls gets all the calls that were made to Delete. Check the length with:

len(mockedCommitLog.DeleteCalls())

func (*CommitLog) NewReader

func (mock *CommitLog) NewReader(offset int64, maxBytes int32) (io.Reader, error)

NewReader calls NewReaderFunc.

func (*CommitLog) NewReaderCalled

func (mock *CommitLog) NewReaderCalled() bool

NewReaderCalled returns true if at least one call was made to NewReader.

func (*CommitLog) NewReaderCalls

func (mock *CommitLog) NewReaderCalls() []struct {
	Offset   int64
	MaxBytes int32
}

NewReaderCalls gets all the calls that were made to NewReader. Check the length with:

len(mockedCommitLog.NewReaderCalls())

func (*CommitLog) NewestOffset

func (mock *CommitLog) NewestOffset() int64

NewestOffset calls NewestOffsetFunc.

func (*CommitLog) NewestOffsetCalled

func (mock *CommitLog) NewestOffsetCalled() bool

NewestOffsetCalled returns true if at least one call was made to NewestOffset.

func (*CommitLog) NewestOffsetCalls

func (mock *CommitLog) NewestOffsetCalls() []struct {
}

NewestOffsetCalls gets all the calls that were made to NewestOffset. Check the length with:

len(mockedCommitLog.NewestOffsetCalls())

func (*CommitLog) OldestOffset

func (mock *CommitLog) OldestOffset() int64

OldestOffset calls OldestOffsetFunc.

func (*CommitLog) OldestOffsetCalled

func (mock *CommitLog) OldestOffsetCalled() bool

OldestOffsetCalled returns true if at least one call was made to OldestOffset.

func (*CommitLog) OldestOffsetCalls

func (mock *CommitLog) OldestOffsetCalls() []struct {
}

OldestOffsetCalls gets all the calls that were made to OldestOffset. Check the length with:

len(mockedCommitLog.OldestOffsetCalls())

func (*CommitLog) Reset

func (mock *CommitLog) Reset()

Reset resets the calls made to the mocked APIs.

func (*CommitLog) Truncate

func (mock *CommitLog) Truncate(in1 int64) error

Truncate calls TruncateFunc.

func (*CommitLog) TruncateCalled

func (mock *CommitLog) TruncateCalled() bool

TruncateCalled returns true if at least one call was made to Truncate.

func (*CommitLog) TruncateCalls

func (mock *CommitLog) TruncateCalls() []struct {
	In1 int64
}

TruncateCalls gets all the calls that were made to Truncate. Check the length with:

len(mockedCommitLog.TruncateCalls())

type Raft

type Raft struct {
	// AddrFunc mocks the Addr method.
	AddrFunc func() string

	// ApplyFunc mocks the Apply method.
	ApplyFunc func(cmd jocko.RaftCommand) error

	// BootstrapFunc mocks the Bootstrap method.
	BootstrapFunc func(serf jocko.Serf, serfEventCh <-chan *jocko.ClusterMember, commandCh chan<- jocko.RaftCommand) error

	// IsLeaderFunc mocks the IsLeader method.
	IsLeaderFunc func() bool

	// LeaderIDFunc mocks the LeaderID method.
	LeaderIDFunc func() string

	// ShutdownFunc mocks the Shutdown method.
	ShutdownFunc func() error
	// contains filtered or unexported fields
}

Raft is a mock implementation of Raft.

    func TestSomethingThatUsesRaft(t *testing.T) {

        // make and configure a mocked Raft
        mockedRaft := &Raft{
            AddrFunc: func() string {
	               panic("TODO: mock out the Addr method")
            },
            ApplyFunc: func(cmd jocko.RaftCommand) error {
	               panic("TODO: mock out the Apply method")
            },
            BootstrapFunc: func(serf jocko.Serf,serfEventCh <-chan *jocko.ClusterMember,commandCh chan<- jocko.RaftCommand) error {
	               panic("TODO: mock out the Bootstrap method")
            },
            IsLeaderFunc: func() bool {
	               panic("TODO: mock out the IsLeader method")
            },
            LeaderIDFunc: func() string {
	               panic("TODO: mock out the LeaderID method")
            },
            ShutdownFunc: func() error {
	               panic("TODO: mock out the Shutdown method")
            },
        }

        // TODO: use mockedRaft in code that requires Raft
        //       and then make assertions.

    }

func (*Raft) Addr

func (mock *Raft) Addr() string

Addr calls AddrFunc.

func (*Raft) AddrCalled

func (mock *Raft) AddrCalled() bool

AddrCalled returns true if at least one call was made to Addr.

func (*Raft) AddrCalls

func (mock *Raft) AddrCalls() []struct {
}

AddrCalls gets all the calls that were made to Addr. Check the length with:

len(mockedRaft.AddrCalls())

func (*Raft) Apply

func (mock *Raft) Apply(cmd jocko.RaftCommand) error

Apply calls ApplyFunc.

func (*Raft) ApplyCalled

func (mock *Raft) ApplyCalled() bool

ApplyCalled returns true if at least one call was made to Apply.

func (*Raft) ApplyCalls

func (mock *Raft) ApplyCalls() []struct {
	Cmd jocko.RaftCommand
}

ApplyCalls gets all the calls that were made to Apply. Check the length with:

len(mockedRaft.ApplyCalls())

func (*Raft) Bootstrap

func (mock *Raft) Bootstrap(serf jocko.Serf, serfEventCh <-chan *jocko.ClusterMember, commandCh chan<- jocko.RaftCommand) error

Bootstrap calls BootstrapFunc.

func (*Raft) BootstrapCalled

func (mock *Raft) BootstrapCalled() bool

BootstrapCalled returns true if at least one call was made to Bootstrap.

func (*Raft) BootstrapCalls

func (mock *Raft) BootstrapCalls() []struct {
	Serf        jocko.Serf
	SerfEventCh <-chan *jocko.ClusterMember
	CommandCh   chan<- jocko.RaftCommand
}

BootstrapCalls gets all the calls that were made to Bootstrap. Check the length with:

len(mockedRaft.BootstrapCalls())

func (*Raft) IsLeader

func (mock *Raft) IsLeader() bool

IsLeader calls IsLeaderFunc.

func (*Raft) IsLeaderCalled

func (mock *Raft) IsLeaderCalled() bool

IsLeaderCalled returns true if at least one call was made to IsLeader.

func (*Raft) IsLeaderCalls

func (mock *Raft) IsLeaderCalls() []struct {
}

IsLeaderCalls gets all the calls that were made to IsLeader. Check the length with:

len(mockedRaft.IsLeaderCalls())

func (*Raft) LeaderID

func (mock *Raft) LeaderID() string

LeaderID calls LeaderIDFunc.

func (*Raft) LeaderIDCalled

func (mock *Raft) LeaderIDCalled() bool

LeaderIDCalled returns true if at least one call was made to LeaderID.

func (*Raft) LeaderIDCalls

func (mock *Raft) LeaderIDCalls() []struct {
}

LeaderIDCalls gets all the calls that were made to LeaderID. Check the length with:

len(mockedRaft.LeaderIDCalls())

func (*Raft) Reset

func (mock *Raft) Reset()

Reset resets the calls made to the mocked APIs.

func (*Raft) Shutdown

func (mock *Raft) Shutdown() error

Shutdown calls ShutdownFunc.

func (*Raft) ShutdownCalled

func (mock *Raft) ShutdownCalled() bool

ShutdownCalled returns true if at least one call was made to Shutdown.

func (*Raft) ShutdownCalls

func (mock *Raft) ShutdownCalls() []struct {
}

ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:

len(mockedRaft.ShutdownCalls())

type Serf

type Serf struct {
	// BootstrapFunc mocks the Bootstrap method.
	BootstrapFunc func(node *jocko.ClusterMember, reconcileCh chan<- *jocko.ClusterMember) error

	// ClusterFunc mocks the Cluster method.
	ClusterFunc func() []*jocko.ClusterMember

	// IDFunc mocks the ID method.
	IDFunc func() int32

	// JoinFunc mocks the Join method.
	JoinFunc func(addrs ...string) (int, error)

	// MemberFunc mocks the Member method.
	MemberFunc func(memberID int32) *jocko.ClusterMember

	// ShutdownFunc mocks the Shutdown method.
	ShutdownFunc func() error
	// contains filtered or unexported fields
}

Serf is a mock implementation of Serf.

    func TestSomethingThatUsesSerf(t *testing.T) {

        // make and configure a mocked Serf
        mockedSerf := &Serf{
            BootstrapFunc: func(node *jocko.ClusterMember,reconcileCh chan<- *jocko.ClusterMember) error {
	               panic("TODO: mock out the Bootstrap method")
            },
            ClusterFunc: func() []*jocko.ClusterMember {
	               panic("TODO: mock out the Cluster method")
            },
            IDFunc: func() int32 {
	               panic("TODO: mock out the ID method")
            },
            JoinFunc: func(addrs ...string) (int, error) {
	               panic("TODO: mock out the Join method")
            },
            MemberFunc: func(memberID int32) *jocko.ClusterMember {
	               panic("TODO: mock out the Member method")
            },
            ShutdownFunc: func() error {
	               panic("TODO: mock out the Shutdown method")
            },
        }

        // TODO: use mockedSerf in code that requires Serf
        //       and then make assertions.

    }

func (*Serf) Bootstrap

func (mock *Serf) Bootstrap(node *jocko.ClusterMember, reconcileCh chan<- *jocko.ClusterMember) error

Bootstrap calls BootstrapFunc.

func (*Serf) BootstrapCalled

func (mock *Serf) BootstrapCalled() bool

BootstrapCalled returns true if at least one call was made to Bootstrap.

func (*Serf) BootstrapCalls

func (mock *Serf) BootstrapCalls() []struct {
	Node        *jocko.ClusterMember
	ReconcileCh chan<- *jocko.ClusterMember
}

BootstrapCalls gets all the calls that were made to Bootstrap. Check the length with:

len(mockedSerf.BootstrapCalls())

func (*Serf) Cluster

func (mock *Serf) Cluster() []*jocko.ClusterMember

Cluster calls ClusterFunc.

func (*Serf) ClusterCalled

func (mock *Serf) ClusterCalled() bool

ClusterCalled returns true if at least one call was made to Cluster.

func (*Serf) ClusterCalls

func (mock *Serf) ClusterCalls() []struct {
}

ClusterCalls gets all the calls that were made to Cluster. Check the length with:

len(mockedSerf.ClusterCalls())

func (*Serf) ID

func (mock *Serf) ID() int32

ID calls IDFunc.

func (*Serf) IDCalled

func (mock *Serf) IDCalled() bool

IDCalled returns true if at least one call was made to ID.

func (*Serf) IDCalls

func (mock *Serf) IDCalls() []struct {
}

IDCalls gets all the calls that were made to ID. Check the length with:

len(mockedSerf.IDCalls())

func (*Serf) Join

func (mock *Serf) Join(addrs ...string) (int, error)

Join calls JoinFunc.

func (*Serf) JoinCalled

func (mock *Serf) JoinCalled() bool

JoinCalled returns true if at least one call was made to Join.

func (*Serf) JoinCalls

func (mock *Serf) JoinCalls() []struct {
	Addrs []string
}

JoinCalls gets all the calls that were made to Join. Check the length with:

len(mockedSerf.JoinCalls())

func (*Serf) Member

func (mock *Serf) Member(memberID int32) *jocko.ClusterMember

Member calls MemberFunc.

func (*Serf) MemberCalled

func (mock *Serf) MemberCalled() bool

MemberCalled returns true if at least one call was made to Member.

func (*Serf) MemberCalls

func (mock *Serf) MemberCalls() []struct {
	MemberID int32
}

MemberCalls gets all the calls that were made to Member. Check the length with:

len(mockedSerf.MemberCalls())

func (*Serf) Reset

func (mock *Serf) Reset()

Reset resets the calls made to the mocked APIs.

func (*Serf) Shutdown

func (mock *Serf) Shutdown() error

Shutdown calls ShutdownFunc.

func (*Serf) ShutdownCalled

func (mock *Serf) ShutdownCalled() bool

ShutdownCalled returns true if at least one call was made to Shutdown.

func (*Serf) ShutdownCalls

func (mock *Serf) ShutdownCalls() []struct {
}

ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:

len(mockedSerf.ShutdownCalls())

Jump to

Keyboard shortcuts

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