test

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StaticAuditContext = &commands.AuditContext{
		UserId: "userId",
	}
)

Functions

func AcceptanceTest

func AcceptanceTest(ctx context.Context, t *testing.T, store eventstore.EventStore)

func GetEventsTest

func GetEventsTest(ctx context.Context, t *testing.T, store eventstore.EventStore)

func MakeAuditContext

func MakeAuditContext(userID string, correlationID string) *commands.AuditContext

func MakeDeviceMetadata

func MakeDeviceMetadata(deviceID string, deviceMetadataUpdated *events.DeviceMetadataUpdated, eventMetadata *events.EventMetadata) eventstore.EventUnmarshaler

func MakeDeviceMetadataUpdatePending

func MakeDeviceMetadataUpdatePending(deviceID string, twinEnabled *events.DeviceMetadataUpdatePending_TwinEnabled, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, validUntil time.Time) eventstore.EventUnmarshaler

func MakeDeviceMetadataUpdated

func MakeDeviceMetadataUpdated(deviceID string, connection *commands.Connection, twinEnabled bool, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, canceled bool) eventstore.EventUnmarshaler

func MakeResourceChangedEvent

func MakeResourceChangedEvent(resourceID *commands.ResourceId, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

func MakeResourceCreatePending

func MakeResourceCreatePending(resourceID *commands.ResourceId, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, validUntil time.Time) eventstore.EventUnmarshaler

func MakeResourceCreated

func MakeResourceCreated(resourceID *commands.ResourceId, status commands.Status, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

func MakeResourceDeletePending

func MakeResourceDeletePending(resourceID *commands.ResourceId, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, validUntil time.Time) eventstore.EventUnmarshaler

func MakeResourceDeleted

func MakeResourceDeleted(resourceID *commands.ResourceId, status commands.Status, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

func MakeResourceLinksPublishedEvent

func MakeResourceLinksPublishedEvent(resources []*commands.Resource, deviceID string, eventMetadata *events.EventMetadata) eventstore.EventUnmarshaler

func MakeResourceLinksSnapshotTaken

func MakeResourceLinksSnapshotTaken(resources map[string]*commands.Resource, deviceID string, eventMetadata *events.EventMetadata) eventstore.EventUnmarshaler

func MakeResourceLinksUnpublishedEvent

func MakeResourceLinksUnpublishedEvent(hrefs []string, deviceID string, eventMetadata *events.EventMetadata) eventstore.EventUnmarshaler

func MakeResourceRetrievePending

func MakeResourceRetrievePending(resourceID *commands.ResourceId, resourceInterface string, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, validUntil time.Time) eventstore.EventUnmarshaler

func MakeResourceRetrieved

func MakeResourceRetrieved(resourceID *commands.ResourceId, status commands.Status, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

func MakeResourceStateSnapshotTaken

func MakeResourceStateSnapshotTaken(resourceID *commands.ResourceId, latestResourceChange *events.ResourceChanged, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

func MakeResourceUpdatePending

func MakeResourceUpdatePending(resourceID *commands.ResourceId, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext, validUntil time.Time) eventstore.EventUnmarshaler

func MakeResourceUpdated

func MakeResourceUpdated(resourceID *commands.ResourceId, status commands.Status, content *commands.Content, eventMetadata *events.EventMetadata, auditContext *commands.AuditContext) eventstore.EventUnmarshaler

Types

type MockEvent

type MockEvent struct {
	VersionI     uint64 `bson:"version"`
	EventTypeI   string `bson:"eventtype"`
	IsSnapshotI  bool   `bson:"issnapshot"`
	AggregateIDI string `bson:"aggregateid"`
	GroupIDI     string `bson:"groupid"`
	DataI        []byte `bson:"data"`
	TimestampI   int64  `bson:"timestamp"`
}

func (MockEvent) AggregateID

func (e MockEvent) AggregateID() string

func (MockEvent) EventType

func (e MockEvent) EventType() string

func (MockEvent) GroupID

func (e MockEvent) GroupID() string

func (MockEvent) IsSnapshot

func (e MockEvent) IsSnapshot() bool

func (MockEvent) Timestamp

func (e MockEvent) Timestamp() time.Time

func (MockEvent) Version

func (e MockEvent) Version() uint64

type MockEventHandler

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

func NewMockEventHandler

func NewMockEventHandler() *MockEventHandler

func (*MockEventHandler) Contains

func (eh *MockEventHandler) Contains(event eventstore.Event) bool

func (*MockEventHandler) ContainsGroupID

func (eh *MockEventHandler) ContainsGroupID(groupID string) bool

func (*MockEventHandler) Count

func (eh *MockEventHandler) Count() int

func (*MockEventHandler) Equals

func (eh *MockEventHandler) Equals(events []eventstore.Event) bool

func (*MockEventHandler) Handle

func (eh *MockEventHandler) Handle(ctx context.Context, iter eventstore.Iter) error

func (*MockEventHandler) SetElement

func (eh *MockEventHandler) SetElement(groupID, aggregateID string, e MockEvent)

func (*MockEventHandler) SnapshotEventType

func (eh *MockEventHandler) SnapshotEventType() string

type MockEventStore

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

func NewMockEventStore

func NewMockEventStore() *MockEventStore

func (*MockEventStore) Append

func (s *MockEventStore) Append(groupID, aggregateID string, ev eventstore.EventUnmarshaler)

func (*MockEventStore) Delete

Delete aggregates events for specific group ids.

func (*MockEventStore) GetEvents

func (*MockEventStore) LoadFromSnapshot

func (s *MockEventStore) LoadFromSnapshot(ctx context.Context, queries []eventstore.SnapshotQuery, eventHandler eventstore.Handler) error

func (*MockEventStore) LoadFromVersion

func (s *MockEventStore) LoadFromVersion(ctx context.Context, queries []eventstore.VersionQuery, eventHandler eventstore.Handler) error

func (*MockEventStore) LoadUpToVersion

LoadUpToVersion loads aggregate events up to a specific version.

func (*MockEventStore) RemoveUpToVersion

func (s *MockEventStore) RemoveUpToVersion(context.Context, []eventstore.VersionQuery) error

RemoveUpToVersion deletes the aggregates events up to a specific version.

func (*MockEventStore) Save

Jump to

Keyboard shortcuts

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