sender

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	// SenderHash calculates the hash of a sender based on the given configuration
	SenderHash(config interface{}) (string, error)
}

type HasherMock

type HasherMock struct {
	// SenderHashFunc mocks the SenderHash method.
	SenderHashFunc func(config interface{}) (string, error)
	// contains filtered or unexported fields
}

HasherMock is a mock implementation of Hasher.

func TestSomethingThatUsesHasher(t *testing.T) {

	// make and configure a mocked Hasher
	mockedHasher := &HasherMock{
		SenderHashFunc: func(config interface{}) (string, error) {
			panic("mock out the SenderHash method")
		},
	}

	// use mockedHasher in code that requires Hasher
	// and then make assertions.

}

func (*HasherMock) SenderHash

func (mock *HasherMock) SenderHash(config interface{}) (string, error)

SenderHash calls SenderHashFunc.

func (*HasherMock) SenderHashCalls

func (mock *HasherMock) SenderHashCalls() []struct {
	Config interface{}
}

SenderHashCalls gets all the calls that were made to SenderHash. Check the length with:

len(mockedHasher.SenderHashCalls())

type InvalidConfigError

type InvalidConfigError struct {
	Err error
}

func (*InvalidConfigError) Error

func (e *InvalidConfigError) Error() string

func (*InvalidConfigError) Unwrap

func (e *InvalidConfigError) Unwrap() error

type NewSenderer

type NewSenderer interface {
	Hasher
	// Returns an objec that implements the Sender interface
	NewSender(config interface{}) (Sender, error)
}

type NewSendererMock

type NewSendererMock struct {
	// NewSenderFunc mocks the NewSender method.
	NewSenderFunc func(config interface{}) (Sender, error)

	// SenderHashFunc mocks the SenderHash method.
	SenderHashFunc func(config interface{}) (string, error)
	// contains filtered or unexported fields
}

NewSendererMock is a mock implementation of NewSenderer.

func TestSomethingThatUsesNewSenderer(t *testing.T) {

	// make and configure a mocked NewSenderer
	mockedNewSenderer := &NewSendererMock{
		NewSenderFunc: func(config interface{}) (Sender, error) {
			panic("mock out the NewSender method")
		},
		SenderHashFunc: func(config interface{}) (string, error) {
			panic("mock out the SenderHash method")
		},
	}

	// use mockedNewSenderer in code that requires NewSenderer
	// and then make assertions.

}

func (*NewSendererMock) NewSender

func (mock *NewSendererMock) NewSender(config interface{}) (Sender, error)

NewSender calls NewSenderFunc.

func (*NewSendererMock) NewSenderCalls

func (mock *NewSendererMock) NewSenderCalls() []struct {
	Config interface{}
}

NewSenderCalls gets all the calls that were made to NewSender. Check the length with:

len(mockedNewSenderer.NewSenderCalls())

func (*NewSendererMock) SenderHash

func (mock *NewSendererMock) SenderHash(config interface{}) (string, error)

SenderHash calls SenderHashFunc.

func (*NewSendererMock) SenderHashCalls

func (mock *NewSendererMock) SenderHashCalls() []struct {
	Config interface{}
}

SenderHashCalls gets all the calls that were made to SenderHash. Check the length with:

len(mockedNewSenderer.SenderHashCalls())

type Sender

type Sender interface {
	// Send consumes and event and sends it to the target
	Send(e event.Event)
	// Unwrap
	Unwrap() Sender
	// StopSending will stop any long running maintenance threads in the sender plugin.
	// Often this function does nothing.
	StopSending(ctx context.Context)
}

or Outputter[√] or Producer[x] or Publisher[√]

type SenderMock

type SenderMock struct {
	// SendFunc mocks the Send method.
	SendFunc func(e event.Event)

	// StopSendingFunc mocks the StopSending method.
	StopSendingFunc func(ctx context.Context)

	// UnwrapFunc mocks the Unwrap method.
	UnwrapFunc func() Sender
	// contains filtered or unexported fields
}

SenderMock is a mock implementation of Sender.

func TestSomethingThatUsesSender(t *testing.T) {

	// make and configure a mocked Sender
	mockedSender := &SenderMock{
		SendFunc: func(e event.Event)  {
			panic("mock out the Send method")
		},
		StopSendingFunc: func(ctx context.Context)  {
			panic("mock out the StopSending method")
		},
		UnwrapFunc: func() Sender {
			panic("mock out the Unwrap method")
		},
	}

	// use mockedSender in code that requires Sender
	// and then make assertions.

}

func (*SenderMock) Send

func (mock *SenderMock) Send(e event.Event)

Send calls SendFunc.

func (*SenderMock) SendCalls

func (mock *SenderMock) SendCalls() []struct {
	E event.Event
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedSender.SendCalls())

func (*SenderMock) StopSending

func (mock *SenderMock) StopSending(ctx context.Context)

StopSending calls StopSendingFunc.

func (*SenderMock) StopSendingCalls

func (mock *SenderMock) StopSendingCalls() []struct {
	Ctx context.Context
}

StopSendingCalls gets all the calls that were made to StopSending. Check the length with:

len(mockedSender.StopSendingCalls())

func (*SenderMock) Unwrap

func (mock *SenderMock) Unwrap() Sender

Unwrap calls UnwrapFunc.

func (*SenderMock) UnwrapCalls

func (mock *SenderMock) UnwrapCalls() []struct {
}

UnwrapCalls gets all the calls that were made to Unwrap. Check the length with:

len(mockedSender.UnwrapCalls())

Jump to

Keyboard shortcuts

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