providers

package
v2.0.0-alpha.3+incompa... Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectionInput  = "input"
	DirectionOutput = "output"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthBasic

type AuthBasic struct {
	User     string `hcl:"user"`
	Password string `hcl:"password"`
}

type AuthMTLS

type AuthMTLS struct {
	TLSClientKey    string `hcl:"tls_client_key"`
	TLSClientCert   string `hcl:"tls_client_cert"`
	TLSClientCACert string `hcl:"tls_client_cacert"`
}

type ConnectionPool

type ConnectionPool interface {
}

type ConnectionPoolMock

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

ConnectionPoolMock is a mock implementation of ConnectionPool.

func TestSomethingThatUsesConnectionPool(t *testing.T) {

    // make and configure a mocked ConnectionPool
    mockedConnectionPool := &ConnectionPoolMock{
    }

    // TODO: use mockedConnectionPool in code that requires ConnectionPool
    //       and then make assertions.

}

type Message

type Message struct {
	// ID is a random message ID
	ID string
	// ParentID allows a message to be traced through a pipeline, actions, success and fail messages
	// will have the a parent ID equal to the recieved message ID
	ParentID string
	// Data is an arbitrary data payload for the message
	Data []byte
	// ContentType for the message if known
	ContentType string
	// Timestamp for the message nanoseconds since 1970
	Timestamp int64
	// Redelivered is set if this message is a re-delivery
	Redelivered bool
	// Sequence number for the message
	Sequence uint64
	// Metadata contains miscellanious information information
	Metadata map[string]string
}

func NewMessage

func NewMessage() Message

func (*Message) Ack

func (m *Message) Ack()

Ack acknowledged receipt and processing of a message

func (*Message) Copy

func (m *Message) Copy() Message

Copy the message to a new instance

type Provider

type Provider interface {
	Name() string
	Type() string                     // Type returns the type of the provider
	Direction() string                // Direction returns input or output
	Setup() error                     // Setup to initalize any connection for the provider
	Listen() (<-chan *Message, error) // Listen for messages
	Publish(Message) (Message, error) // Publish a message to the outbound provider
	Stop() error                      // Stop listening for messages
}

Provider defines a generic interface than an input or an output must implement

type ProviderMock

type ProviderMock struct {
	// DirectionFunc mocks the Direction method.
	DirectionFunc func() string

	// ListenFunc mocks the Listen method.
	ListenFunc func() (<-chan *Message, error)

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

	// PublishFunc mocks the Publish method.
	PublishFunc func(in1 Message) (Message, error)

	// SetupFunc mocks the Setup method.
	SetupFunc func() error

	// StopFunc mocks the Stop method.
	StopFunc func() error

	// TypeFunc mocks the Type method.
	TypeFunc func() string
	// contains filtered or unexported fields
}

ProviderMock is a mock implementation of Provider.

    func TestSomethingThatUsesProvider(t *testing.T) {

        // make and configure a mocked Provider
        mockedProvider := &ProviderMock{
            DirectionFunc: func() string {
	               panic("TODO: mock out the Direction method")
            },
            ListenFunc: func() (<-chan *Message, error) {
	               panic("TODO: mock out the Listen method")
            },
            NameFunc: func() string {
	               panic("TODO: mock out the Name method")
            },
            PublishFunc: func(in1 Message) (Message, error) {
	               panic("TODO: mock out the Publish method")
            },
            SetupFunc: func() error {
	               panic("TODO: mock out the Setup method")
            },
            StopFunc: func() error {
	               panic("TODO: mock out the Stop method")
            },
            TypeFunc: func() string {
	               panic("TODO: mock out the Type method")
            },
        }

        // TODO: use mockedProvider in code that requires Provider
        //       and then make assertions.

    }

func (*ProviderMock) Direction

func (mock *ProviderMock) Direction() string

Direction calls DirectionFunc.

func (*ProviderMock) DirectionCalls

func (mock *ProviderMock) DirectionCalls() []struct {
}

DirectionCalls gets all the calls that were made to Direction. Check the length with:

len(mockedProvider.DirectionCalls())

func (*ProviderMock) Listen

func (mock *ProviderMock) Listen() (<-chan *Message, error)

Listen calls ListenFunc.

func (*ProviderMock) ListenCalls

func (mock *ProviderMock) ListenCalls() []struct {
}

ListenCalls gets all the calls that were made to Listen. Check the length with:

len(mockedProvider.ListenCalls())

func (*ProviderMock) Name

func (mock *ProviderMock) Name() string

Name calls NameFunc.

func (*ProviderMock) NameCalls

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

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

len(mockedProvider.NameCalls())

func (*ProviderMock) Publish

func (mock *ProviderMock) Publish(in1 Message) (Message, error)

Publish calls PublishFunc.

func (*ProviderMock) PublishCalls

func (mock *ProviderMock) PublishCalls() []struct {
	In1 Message
}

PublishCalls gets all the calls that were made to Publish. Check the length with:

len(mockedProvider.PublishCalls())

func (*ProviderMock) Setup

func (mock *ProviderMock) Setup() error

Setup calls SetupFunc.

func (*ProviderMock) SetupCalls

func (mock *ProviderMock) SetupCalls() []struct {
}

SetupCalls gets all the calls that were made to Setup. Check the length with:

len(mockedProvider.SetupCalls())

func (*ProviderMock) Stop

func (mock *ProviderMock) Stop() error

Stop calls StopFunc.

func (*ProviderMock) StopCalls

func (mock *ProviderMock) StopCalls() []struct {
}

StopCalls gets all the calls that were made to Stop. Check the length with:

len(mockedProvider.StopCalls())

func (*ProviderMock) Type

func (mock *ProviderMock) Type() string

Type calls TypeFunc.

func (*ProviderMock) TypeCalls

func (mock *ProviderMock) TypeCalls() []struct {
}

TypeCalls gets all the calls that were made to Type. Check the length with:

len(mockedProvider.TypeCalls())

type TLS

type TLS struct {
	TLSClientKey  string `hcl:"tls_client_key"`
	TLSClientCert string `hcl:"tls_client_cert"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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