fixtures

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fixtures contains test implementations of Dogma entities.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MessageAType is the message.Type for the MessageA struct.
	MessageAType = message.TypeOf(MessageA{})

	// MessageA1 is an instance of MessageA with a distinct value to be used in tests.
	MessageA1 = MessageA{"A1"}
	// MessageA2 is an instance of MessageA with a distinct value to be used in tests.
	MessageA2 = MessageA{"A2"}
	// MessageA3 is an instance of MessageA with a distinct value to be used in tests.
	MessageA3 = MessageA{"A3"}
)
View Source
var (
	// MessageBType is the message.Type for the MessageB struct.
	MessageBType = message.TypeOf(MessageB{})

	// MessageB1 is an instance of MessageB with a distinct value to be used in tests.
	MessageB1 = MessageB{"B1"}
	// MessageB2 is an instance of MessageB with a distinct value to be used in tests.
	MessageB2 = MessageB{"B2"}
	// MessageB3 is an instance of MessageB with a distinct value to be used in tests.
	MessageB3 = MessageB{"B3"}
)
View Source
var (
	// MessageCType is the message.Type for the MessageC struct.
	MessageCType = message.TypeOf(MessageC{})

	// MessageC1 is an instance of MessageC with a distinct value to be used in tests.
	MessageC1 = MessageC{"C1"}
	// MessageC2 is an instance of MessageC with a distinct value to be used in tests.
	MessageC2 = MessageC{"C2"}
	// MessageC3 is an instance of MessageC with a distinct value to be used in tests.
	MessageC3 = MessageC{"C3"}
)
View Source
var (
	// MessageDType is the message.Type for the MessageD struct.
	MessageDType = message.TypeOf(MessageD{})

	// MessageD1 is an instance of MessageD with a distinct value to be used in tests.
	MessageD1 = MessageD{"D1"}
	// MessageD2 is an instance of MessageD with a distinct value to be used in tests.
	MessageD2 = MessageD{"D2"}
	// MessageD3 is an instance of MessageD with a distinct value to be used in tests.
	MessageD3 = MessageD{"D3"}
)
View Source
var (
	// MessageEType is the message.Type for the MessageE struct.
	MessageEType = message.TypeOf(MessageE{})

	// MessageE1 is an instance of MessageE with a distinct value to be used in tests.
	MessageE1 = MessageE{"E1"}
	// MessageE2 is an instance of MessageE with a distinct value to be used in tests.
	MessageE2 = MessageE{"E2"}
	// MessageE3 is an instance of MessageE with a distinct value to be used in tests.
	MessageE3 = MessageE{"E3"}
)
View Source
var (
	// MessageFType is the message.Type for the MessageF struct.
	MessageFType = message.TypeOf(MessageF{})

	// MessageF1 is an instance of MessageF with a distinct value to be used in tests.
	MessageF1 = MessageF{"F1"}
	// MessageF2 is an instance of MessageF with a distinct value to be used in tests.
	MessageF2 = MessageF{"F2"}
	// MessageF3 is an instance of MessageF with a distinct value to be used in tests.
	MessageF3 = MessageF{"F3"}
)
View Source
var (
	// MessageGType is the message.Type for the MessageG struct.
	MessageGType = message.TypeOf(MessageG{})

	// MessageG1 is an instance of MessageG with a distinct value to be used in tests.
	MessageG1 = MessageG{"G1"}
	// MessageG2 is an instance of MessageG with a distinct value to be used in tests.
	MessageG2 = MessageG{"G2"}
	// MessageG3 is an instance of MessageG with a distinct value to be used in tests.
	MessageG3 = MessageG{"G3"}
)
View Source
var (
	// MessageHType is the message.Type for the MessageH struct.
	MessageHType = message.TypeOf(MessageH{})

	// MessageH1 is an instance of MessageH with a distinct value to be used in tests.
	MessageH1 = MessageH{"H1"}
	// MessageH2 is an instance of MessageH with a distinct value to be used in tests.
	MessageH2 = MessageH{"H2"}
	// MessageH3 is an instance of MessageH with a distinct value to be used in tests.
	MessageH3 = MessageH{"H3"}
)
View Source
var (
	// MessageIType is the message.Type for the MessageI struct.
	MessageIType = message.TypeOf(MessageI{})

	// MessageI1 is an instance of MessageI with a distinct value to be used in tests.
	MessageI1 = MessageI{"I1"}
	// MessageI2 is an instance of MessageI with a distinct value to be used in tests.
	MessageI2 = MessageI{"I2"}
	// MessageI3 is an instance of MessageI with a distinct value to be used in tests.
	MessageI3 = MessageI{"I3"}
)
View Source
var (
	// MessageJType is the message.Type for the MessageJ struct.
	MessageJType = message.TypeOf(MessageJ{})

	// MessageJ1 is an instance of MessageJ with a distinct value to be used in tests.
	MessageJ1 = MessageJ{"J1"}
	// MessageJ2 is an instance of MessageJ with a distinct value to be used in tests.
	MessageJ2 = MessageJ{"J2"}
	// MessageJ3 is an instance of MessageJ with a distinct value to be used in tests.
	MessageJ3 = MessageJ{"J3"}
)
View Source
var (
	// MessageKType is the message.Type for the MessageK struct.
	MessageKType = message.TypeOf(MessageK{})

	// MessageK1 is an instance of MessageK with a distinct value to be used in tests.
	MessageK1 = MessageK{"K1"}
	// MessageK2 is an instance of MessageK with a distinct value to be used in tests.
	MessageK2 = MessageK{"K2"}
	// MessageK3 is an instance of MessageK with a distinct value to be used in tests.
	MessageK3 = MessageK{"K3"}
)
View Source
var (
	// MessageLType is the message.Type for the MessageL struct.
	MessageLType = message.TypeOf(MessageL{})

	// MessageL1 is an instance of MessageL with a distinct value to be used in tests.
	MessageL1 = MessageL{"L1"}
	// MessageL2 is an instance of MessageL with a distinct value to be used in tests.
	MessageL2 = MessageL{"L2"}
	// MessageL3 is an instance of MessageL with a distinct value to be used in tests.
	MessageL3 = MessageL{"L3"}
)
View Source
var (
	// MessageMType is the message.Type for the MessageM struct.
	MessageMType = message.TypeOf(MessageM{})

	// MessageM1 is an instance of MessageM with a distinct value to be used in tests.
	MessageM1 = MessageM{"M1"}
	// MessageM2 is an instance of MessageM with a distinct value to be used in tests.
	MessageM2 = MessageM{"M2"}
	// MessageM3 is an instance of MessageM with a distinct value to be used in tests.
	MessageM3 = MessageM{"M3"}
)
View Source
var (
	// MessageNType is the message.Type for the MessageN struct.
	MessageNType = message.TypeOf(MessageN{})

	// MessageN1 is an instance of MessageN with a distinct value to be used in tests.
	MessageN1 = MessageN{"N1"}
	// MessageN2 is an instance of MessageN with a distinct value to be used in tests.
	MessageN2 = MessageN{"N2"}
	// MessageN3 is an instance of MessageN with a distinct value to be used in tests.
	MessageN3 = MessageN{"N3"}
)
View Source
var (
	// MessageOType is the message.Type for the MessageO struct.
	MessageOType = message.TypeOf(MessageO{})

	// MessageO1 is an instance of MessageO with a distinct value to be used in tests.
	MessageO1 = MessageO{"O1"}
	// MessageO2 is an instance of MessageO with a distinct value to be used in tests.
	MessageO2 = MessageO{"O2"}
	// MessageO3 is an instance of MessageO with a distinct value to be used in tests.
	MessageO3 = MessageO{"O3"}
)
View Source
var (
	// MessagePType is the message.Type for the MessageP struct.
	MessagePType = message.TypeOf(MessageP{})

	// MessageP1 is an instance of MessageP with a distinct value to be used in tests.
	MessageP1 = MessageP{"P1"}
	// MessageP2 is an instance of MessageP with a distinct value to be used in tests.
	MessageP2 = MessageP{"P2"}
	// MessageP3 is an instance of MessageP with a distinct value to be used in tests.
	MessageP3 = MessageP{"P3"}
)
View Source
var (
	// MessageQType is the message.Type for the MessageQ struct.
	MessageQType = message.TypeOf(MessageQ{})

	// MessageQ1 is an instance of MessageQ with a distinct value to be used in tests.
	MessageQ1 = MessageQ{"Q1"}
	// MessageQ2 is an instance of MessageQ with a distinct value to be used in tests.
	MessageQ2 = MessageQ{"Q2"}
	// MessageQ3 is an instance of MessageQ with a distinct value to be used in tests.
	MessageQ3 = MessageQ{"Q3"}
)
View Source
var (
	// MessageRType is the message.Type for the MessageR struct.
	MessageRType = message.TypeOf(MessageR{})

	// MessageR1 is an instance of MessageR with a distinct value to be used in tests.
	MessageR1 = MessageR{"R1"}
	// MessageR2 is an instance of MessageR with a distinct value to be used in tests.
	MessageR2 = MessageR{"R2"}
	// MessageR3 is an instance of MessageR with a distinct value to be used in tests.
	MessageR3 = MessageR{"R3"}
)
View Source
var (
	// MessageSType is the message.Type for the MessageS struct.
	MessageSType = message.TypeOf(MessageS{})

	// MessageS1 is an instance of MessageS with a distinct value to be used in tests.
	MessageS1 = MessageS{"S1"}
	// MessageS2 is an instance of MessageS with a distinct value to be used in tests.
	MessageS2 = MessageS{"S2"}
	// MessageS3 is an instance of MessageS with a distinct value to be used in tests.
	MessageS3 = MessageS{"S3"}
)
View Source
var (
	// MessageTType is the message.Type for the MessageT struct.
	MessageTType = message.TypeOf(MessageT{})

	// MessageT1 is an instance of MessageT with a distinct value to be used in tests.
	MessageT1 = MessageT{"T1"}
	// MessageT2 is an instance of MessageT with a distinct value to be used in tests.
	MessageT2 = MessageT{"T2"}
	// MessageT3 is an instance of MessageT with a distinct value to be used in tests.
	MessageT3 = MessageT{"T3"}
)
View Source
var (
	// MessageUType is the message.Type for the MessageU struct.
	MessageUType = message.TypeOf(MessageU{})

	// MessageU1 is an instance of MessageU with a distinct value to be used in tests.
	MessageU1 = MessageU{"U1"}
	// MessageU2 is an instance of MessageU with a distinct value to be used in tests.
	MessageU2 = MessageU{"U2"}
	// MessageU3 is an instance of MessageU with a distinct value to be used in tests.
	MessageU3 = MessageU{"U3"}
)
View Source
var (
	// MessageVType is the message.Type for the MessageV struct.
	MessageVType = message.TypeOf(MessageV{})

	// MessageV1 is an instance of MessageV with a distinct value to be used in tests.
	MessageV1 = MessageV{"V1"}
	// MessageV2 is an instance of MessageV with a distinct value to be used in tests.
	MessageV2 = MessageV{"V2"}
	// MessageV3 is an instance of MessageV with a distinct value to be used in tests.
	MessageV3 = MessageV{"V3"}
)
View Source
var (
	// MessageWType is the message.Type for the MessageW struct.
	MessageWType = message.TypeOf(MessageW{})

	// MessageW1 is an instance of MessageW with a distinct value to be used in tests.
	MessageW1 = MessageW{"W1"}
	// MessageW2 is an instance of MessageW with a distinct value to be used in tests.
	MessageW2 = MessageW{"W2"}
	// MessageW3 is an instance of MessageW with a distinct value to be used in tests.
	MessageW3 = MessageW{"W3"}
)
View Source
var (
	// MessageXType is the message.Type for the MessageX struct.
	MessageXType = message.TypeOf(MessageX{})

	// MessageX1 is an instance of MessageX with a distinct value to be used in tests.
	MessageX1 = MessageX{"X1"}
	// MessageX2 is an instance of MessageX with a distinct value to be used in tests.
	MessageX2 = MessageX{"X2"}
	// MessageX3 is an instance of MessageX with a distinct value to be used in tests.
	MessageX3 = MessageX{"X3"}
)
View Source
var (
	// MessageYType is the message.Type for the MessageY struct.
	MessageYType = message.TypeOf(MessageY{})

	// MessageY1 is an instance of MessageY with a distinct value to be used in tests.
	MessageY1 = MessageY{"Y1"}
	// MessageY2 is an instance of MessageY with a distinct value to be used in tests.
	MessageY2 = MessageY{"Y2"}
	// MessageY3 is an instance of MessageY with a distinct value to be used in tests.
	MessageY3 = MessageY{"Y3"}
)
View Source
var (
	// MessageZType is the message.Type for the MessageZ struct.
	MessageZType = message.TypeOf(MessageZ{})

	// MessageZ1 is an instance of MessageZ with a distinct value to be used in tests.
	MessageZ1 = MessageZ{"Z1"}
	// MessageZ2 is an instance of MessageZ with a distinct value to be used in tests.
	MessageZ2 = MessageZ{"Z2"}
	// MessageZ3 is an instance of MessageZ with a distinct value to be used in tests.
	MessageZ3 = MessageZ{"Z3"}
)

Functions

This section is empty.

Types

type AggregateMessageHandler

type AggregateMessageHandler struct {
	NewFunc                    func() dogma.AggregateRoot
	ConfigureFunc              func(dogma.AggregateConfigurer)
	RouteCommandToInstanceFunc func(dogma.Message) string
	HandleCommandFunc          func(dogma.AggregateCommandScope, dogma.Message)
}

AggregateMessageHandler is a test implementation of dogma.AggregateMessageHandler.

func (*AggregateMessageHandler) Configure

Configure configures the behavior of the engine as it relates to this handler.

c provides access to the various configuration options, such as specifying which types of domain command messages are routed to this handler.

If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c)

func (*AggregateMessageHandler) HandleCommand

HandleCommand handles a domain command message that has been routed to this handler.

Handling a domain command message involves inspecting the state of the target aggregate instance to determine what changes, if any, should occur. Each change is indicated by recording a domain event message.

s provides access to the operations available within the scope of handling m, such as creating or destroying the targeted instance, accessing its state, and recording domain event messages.

This method must not modify the targeted instance directly. All modifications must be applied by the instance's ApplyEvent() method, which is called for each domain event message that is recorded via s.

It panics with the UnexpectedMessage value if m is not one of the domain command types that is routed to this handler via Configure().

If h.HandleCommandFunc is non-nil it calls h.HandleCommandFunc(s, m).

func (*AggregateMessageHandler) New

New constructs a new aggregate instance and returns its root.

If h.NewFunc is nil, it returns a new empty fixtures.AggregateRoot, otherwise it calls h.NewFunc().

func (*AggregateMessageHandler) RouteCommandToInstance

func (h *AggregateMessageHandler) RouteCommandToInstance(m dogma.Message) string

RouteCommandToInstance returns the ID of the aggregate instance that is targetted by m.

It panics with the UnexpectedMessage value if m is not one of the domain command types that is routed to this handler via Configure().

If h.RouteCommandToInstanceFunc is non-nil it returns the result of h.RouteCommandToInstanceFunc(m), otherwise it panics.

type AggregateRoot

type AggregateRoot struct {
	Value          interface{}
	ApplyEventFunc func(dogma.Message, interface{})
}

AggregateRoot is a test implementation of dogma.AggregateRoot.

func (*AggregateRoot) ApplyEvent

func (v *AggregateRoot) ApplyEvent(m dogma.Message)

ApplyEvent updates the aggregate instance to reflect the fact that a particular domain event has occurred.

It calls v.ApplyEventFunc(m, v.Value)

type Application

type Application struct {
	ConfigureFunc func(dogma.ApplicationConfigurer)
}

Application is a test implementation of dogma.Application.

func (*Application) Configure

func (a *Application) Configure(c dogma.ApplicationConfigurer)

Configure configures the behavior of the engine as it relates to this application.

c provides access to the various configuration options, such as specifying which message handlers the application contains.

If a.ConfigureFunc is non-nil, it calls a.ConfigureFunc(c)

type IntegrationMessageHandler

type IntegrationMessageHandler struct {
	ConfigureFunc     func(dogma.IntegrationConfigurer)
	HandleCommandFunc func(context.Context, dogma.IntegrationCommandScope, dogma.Message) error
}

IntegrationMessageHandler is a test implementation of dogma.IntegrationMessageHandler.

func (*IntegrationMessageHandler) Configure

Configure configures the behavior of the engine as it relates to this handler.

c provides access to the various configuration options, such as specifying which types of integration command messages are routed to this handler.

If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c)

func (*IntegrationMessageHandler) HandleCommand

HandleCommand handles an integration command message that has been routed to this handler.

s provides access to the operations available within the scope of handling m, such as publishing integration event messages.

It panics with the UnexpectedMessage value if m is not one of the integration command types that is routed to this handler via Configure().

If h.HandleCommandFunc is non-nil it calls h.HandleCommandFunc(s, m).

type MessageA

type MessageA struct {
	Value interface{}
}

MessageA is type used as a dogma.Message in tests.

type MessageB

type MessageB struct {
	Value interface{}
}

MessageB is type used as a dogma.Message in tests.

type MessageC

type MessageC struct {
	Value interface{}
}

MessageC is type used as a dogma.Message in tests.

type MessageD

type MessageD struct {
	Value interface{}
}

MessageD is type used as a dogma.Message in tests.

type MessageE

type MessageE struct {
	Value interface{}
}

MessageE is type used as a dogma.Message in tests.

type MessageF

type MessageF struct {
	Value interface{}
}

MessageF is type used as a dogma.Message in tests.

type MessageG

type MessageG struct {
	Value interface{}
}

MessageG is type used as a dogma.Message in tests.

type MessageH

type MessageH struct {
	Value interface{}
}

MessageH is type used as a dogma.Message in tests.

type MessageI

type MessageI struct {
	Value interface{}
}

MessageI is type used as a dogma.Message in tests.

type MessageJ

type MessageJ struct {
	Value interface{}
}

MessageJ is type used as a dogma.Message in tests.

type MessageK

type MessageK struct {
	Value interface{}
}

MessageK is type used as a dogma.Message in tests.

type MessageL

type MessageL struct {
	Value interface{}
}

MessageL is type used as a dogma.Message in tests.

type MessageM

type MessageM struct {
	Value interface{}
}

MessageM is type used as a dogma.Message in tests.

type MessageN

type MessageN struct {
	Value interface{}
}

MessageN is type used as a dogma.Message in tests.

type MessageO

type MessageO struct {
	Value interface{}
}

MessageO is type used as a dogma.Message in tests.

type MessageP

type MessageP struct {
	Value interface{}
}

MessageP is type used as a dogma.Message in tests.

type MessageQ

type MessageQ struct {
	Value interface{}
}

MessageQ is type used as a dogma.Message in tests.

type MessageR

type MessageR struct {
	Value interface{}
}

MessageR is type used as a dogma.Message in tests.

type MessageS

type MessageS struct {
	Value interface{}
}

MessageS is type used as a dogma.Message in tests.

type MessageT

type MessageT struct {
	Value interface{}
}

MessageT is type used as a dogma.Message in tests.

type MessageU

type MessageU struct {
	Value interface{}
}

MessageU is type used as a dogma.Message in tests.

type MessageV

type MessageV struct {
	Value interface{}
}

MessageV is type used as a dogma.Message in tests.

type MessageW

type MessageW struct {
	Value interface{}
}

MessageW is type used as a dogma.Message in tests.

type MessageX

type MessageX struct {
	Value interface{}
}

MessageX is type used as a dogma.Message in tests.

type MessageY

type MessageY struct {
	Value interface{}
}

MessageY is type used as a dogma.Message in tests.

type MessageZ

type MessageZ struct {
	Value interface{}
}

MessageZ is type used as a dogma.Message in tests.

type ProcessMessageHandler

type ProcessMessageHandler struct {
	NewFunc                  func() dogma.ProcessRoot
	ConfigureFunc            func(dogma.ProcessConfigurer)
	RouteEventToInstanceFunc func(context.Context, dogma.Message) (string, bool, error)
	HandleEventFunc          func(context.Context, dogma.ProcessEventScope, dogma.Message) error
	HandleTimeoutFunc        func(context.Context, dogma.ProcessTimeoutScope, dogma.Message) error
}

ProcessMessageHandler is a test implementation of dogma.ProcessMessageHandler.

func (*ProcessMessageHandler) Configure

Configure configures the behavior of the engine as it relates to this handler.

c provides access to the various configuration options, such as specifying which types of event messages are routed to this handler.

If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c)

func (*ProcessMessageHandler) HandleEvent

HandleEvent handles an event message that has been routed to this handler.

Handling an event message involves inspecting the state of the target process instance to determine what command messages, if any, should be produced.

s provides access to the operations available within the scope of handling m, such as beginning or ending the targeted instance, accessing its state, sending command messages or scheduling timeouts.

This method may manipulate the process's state directly.

It panics with the UnexpectedMessage value if m is not one of the event types that is routed to this handler via Configure().

If h.HandleEventFunc is non-nil it calls h.HandleEventFunc(ctx, s, m).

func (*ProcessMessageHandler) HandleTimeout

HandleTimeout handles a timeout message that has been scheduled with ProcessScope.ScheduleTimeout().

Timeouts can be used to model time within the domain. For example, an application might use a timeout to mark an invoice as overdue after some period of non-payment.

Handling a timeout is much like handling an event in that much the same operations are available to the handler via s.

This method may manipulate the process's state directly.

If m was not expected by the handler the implementation must panic with an UnexpectedMessage value.

If h.HandleTimeoutFunc is non-nil it calls h.HandleTimeoutFunc(ctx, s, m).

func (*ProcessMessageHandler) New

New constructs a new process instance and returns its root.

If h.NewFunc is nil, it returns a new empty fixtures.ProcessRoot, otherwise it calls h.NewFunc().

func (*ProcessMessageHandler) RouteEventToInstance

func (h *ProcessMessageHandler) RouteEventToInstance(
	ctx context.Context,
	m dogma.Message,
) (string, bool, error)

RouteEventToInstance returns the ID of the process instance that is targetted by m.

It panics with the UnexpectedMessage value if m is not one of the event types that is routed to this handler via Configure().

If ok is false, the message is not routed to this handler at all.

If h.RouteEventToInstance is non-nil it returns the result of h.RouteEventToInstance(ctx, m), otherwise it panics.

type ProcessRoot

type ProcessRoot struct {
	Value interface{}
}

ProcessRoot is a test implementation of dogma.ProcessRoot.

type ProjectionMessageHandler

type ProjectionMessageHandler struct {
	ConfigureFunc   func(dogma.ProjectionConfigurer)
	HandleEventFunc func(context.Context, dogma.ProjectionEventScope, dogma.Message) error
}

ProjectionMessageHandler is a test implementation of dogma.ProjectionMessageHandler.

func (*ProjectionMessageHandler) Configure

Configure configures the behavior of the engine as it relates to this handler.

c provides access to the various configuration options, such as specifying which types of event messages are routed to this handler.

If h.ConfigureFunc is non-nil, it calls h.ConfigureFunc(c)

func (*ProjectionMessageHandler) HandleEvent

HandleEvent handles a domain event message that has been routed to this handler.

s provides access to the operations available within the scope of handling m.

It panics with the UnexpectedMessage value if m is not one of the event types that is routed to this handler via Configure().

If h.HandleEventFunc is non-nil it calls h.HandleEventFunc(s, m).

Jump to

Keyboard shortcuts

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