sender

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 7 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(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (Sender, error)
}

type NewSendererMock

type NewSendererMock struct {
	// NewSenderFunc mocks the NewSender method.
	NewSenderFunc func(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (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(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault) (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(tid tenant.Id, plugin string, name string, config interface{}, secrets secret.Vault, tableSyncer syncer.DeltaSyncer) (Sender, error)

NewSender calls NewSenderFunc.

func (*NewSendererMock) NewSenderCalls

func (mock *NewSendererMock) NewSenderCalls() []struct {
	Tid     tenant.Id
	Plugin  string
	Name    string
	Config  interface{}
	Secrets secret.Vault
}

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)
	//
	Config() interface{}
	Name() string
	Plugin() string
	Tenant() tenant.Id
	EventSuccessCount() int
	EventSuccessVelocity() int
	EventErrorCount() int
	EventErrorVelocity() int
	EventTs() int64
}

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

type SenderMock

type SenderMock struct {
	// ConfigFunc mocks the Config method.
	ConfigFunc func() interface{}

	// NameFunc mocks the Name method.
	NameFunc func() string

	// PluginFunc mocks the Plugin method.
	PluginFunc func() string

	// SendFunc mocks the Send method.
	SendFunc func(e event.Event)

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

	// TenantFunc mocks the Tenant method.
	TenantFunc func() tenant.Id

	// 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{
		ConfigFunc: func() interface{} {
			panic("mock out the Config method")
		},
		NameFunc: func() string {
			panic("mock out the Name method")
		},
		PluginFunc: func() string {
			panic("mock out the Plugin method")
		},
		SendFunc: func(e event.Event)  {
			panic("mock out the Send method")
		},
		StopSendingFunc: func(ctx context.Context)  {
			panic("mock out the StopSending method")
		},
		TenantFunc: func() tenant.Id {
			panic("mock out the Tenant method")
		},
		UnwrapFunc: func() Sender {
			panic("mock out the Unwrap method")
		},
	}

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

}

func (*SenderMock) Config added in v0.2.1

func (mock *SenderMock) Config() interface{}

Config calls ConfigFunc.

func (*SenderMock) ConfigCalls added in v0.2.1

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

ConfigCalls gets all the calls that were made to Config. Check the length with:

len(mockedSender.ConfigCalls())

func (*SenderMock) EventErrorCount added in v1.1.2

func (mock *SenderMock) EventErrorCount() int

func (*SenderMock) EventErrorVelocity added in v1.1.2

func (mock *SenderMock) EventErrorVelocity() int

func (*SenderMock) EventSuccessCount added in v1.1.2

func (mock *SenderMock) EventSuccessCount() int

func (*SenderMock) EventSuccessVelocity added in v1.1.2

func (mock *SenderMock) EventSuccessVelocity() int

func (*SenderMock) EventTs added in v1.1.2

func (mock *SenderMock) EventTs() int64

func (*SenderMock) Name added in v0.2.1

func (mock *SenderMock) Name() string

Name calls NameFunc.

func (*SenderMock) NameCalls added in v0.2.1

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

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedSender.NameCalls())

func (*SenderMock) Plugin added in v0.2.1

func (mock *SenderMock) Plugin() string

Plugin calls PluginFunc.

func (*SenderMock) PluginCalls added in v0.2.1

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

PluginCalls gets all the calls that were made to Plugin. Check the length with:

len(mockedSender.PluginCalls())

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) Tenant added in v0.3.0

func (mock *SenderMock) Tenant() tenant.Id

Tenant calls TenantFunc.

func (*SenderMock) TenantCalls added in v0.3.0

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

TenantCalls gets all the calls that were made to Tenant. Check the length with:

len(mockedSender.TenantCalls())

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