client

package
v0.0.0-...-34fd565 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextBrokerClientMock

type ContextBrokerClientMock struct {
	// CreateEntityFunc mocks the CreateEntity method.
	CreateEntityFunc func(ctx context.Context, entity types.Entity, headers map[string][]string) (*ngsild.CreateEntityResult, error)

	// DeleteEntityFunc mocks the DeleteEntity method.
	DeleteEntityFunc func(ctx context.Context, entityID string) (*ngsild.DeleteEntityResult, error)

	// MergeEntityFunc mocks the MergeEntity method.
	MergeEntityFunc func(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.MergeEntityResult, error)

	// QueryEntitiesFunc mocks the QueryEntities method.
	QueryEntitiesFunc func(ctx context.Context, entityTypes []string, entityAttributes []string, query string, headers map[string][]string) (*ngsild.QueryEntitiesResult, error)

	// QueryTemporalEvolutionOfEntitiesFunc mocks the QueryTemporalEvolutionOfEntities method.
	QueryTemporalEvolutionOfEntitiesFunc func(ctx context.Context, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.QueryTemporalEntitiesResult, error)

	// RetrieveEntityFunc mocks the RetrieveEntity method.
	RetrieveEntityFunc func(ctx context.Context, entityID string, headers map[string][]string) (types.Entity, error)

	// RetrieveTemporalEvolutionOfEntityFunc mocks the RetrieveTemporalEvolutionOfEntity method.
	RetrieveTemporalEvolutionOfEntityFunc func(ctx context.Context, entityID string, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.RetrieveTemporalEvolutionOfEntityResult, error)

	// UpdateEntityAttributesFunc mocks the UpdateEntityAttributes method.
	UpdateEntityAttributesFunc func(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.UpdateEntityAttributesResult, error)
	// contains filtered or unexported fields
}

ContextBrokerClientMock is a mock implementation of ContextBrokerClient.

func TestSomethingThatUsesContextBrokerClient(t *testing.T) {

	// make and configure a mocked ContextBrokerClient
	mockedContextBrokerClient := &ContextBrokerClientMock{
		CreateEntityFunc: func(ctx context.Context, entity types.Entity, headers map[string][]string) (*ngsild.CreateEntityResult, error) {
			panic("mock out the CreateEntity method")
		},
		DeleteEntityFunc: func(ctx context.Context, entityID string) (*ngsild.DeleteEntityResult, error) {
			panic("mock out the DeleteEntity method")
		},
		MergeEntityFunc: func(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.MergeEntityResult, error) {
			panic("mock out the MergeEntity method")
		},
		QueryEntitiesFunc: func(ctx context.Context, entityTypes []string, entityAttributes []string, query string, headers map[string][]string) (*ngsild.QueryEntitiesResult, error) {
			panic("mock out the QueryEntities method")
		},
		QueryTemporalEvolutionOfEntitiesFunc: func(ctx context.Context, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.QueryTemporalEntitiesResult, error) {
			panic("mock out the QueryTemporalEvolutionOfEntities method")
		},
		RetrieveEntityFunc: func(ctx context.Context, entityID string, headers map[string][]string) (types.Entity, error) {
			panic("mock out the RetrieveEntity method")
		},
		RetrieveTemporalEvolutionOfEntityFunc: func(ctx context.Context, entityID string, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.RetrieveTemporalEvolutionOfEntityResult, error) {
			panic("mock out the RetrieveTemporalEvolutionOfEntity method")
		},
		UpdateEntityAttributesFunc: func(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.UpdateEntityAttributesResult, error) {
			panic("mock out the UpdateEntityAttributes method")
		},
	}

	// use mockedContextBrokerClient in code that requires ContextBrokerClient
	// and then make assertions.

}

func (*ContextBrokerClientMock) CreateEntity

func (mock *ContextBrokerClientMock) CreateEntity(ctx context.Context, entity types.Entity, headers map[string][]string) (*ngsild.CreateEntityResult, error)

CreateEntity calls CreateEntityFunc.

func (*ContextBrokerClientMock) CreateEntityCalls

func (mock *ContextBrokerClientMock) CreateEntityCalls() []struct {
	Ctx     context.Context
	Entity  types.Entity
	Headers map[string][]string
}

CreateEntityCalls gets all the calls that were made to CreateEntity. Check the length with:

len(mockedContextBrokerClient.CreateEntityCalls())

func (*ContextBrokerClientMock) DeleteEntity

func (mock *ContextBrokerClientMock) DeleteEntity(ctx context.Context, entityID string) (*ngsild.DeleteEntityResult, error)

DeleteEntity calls DeleteEntityFunc.

func (*ContextBrokerClientMock) DeleteEntityCalls

func (mock *ContextBrokerClientMock) DeleteEntityCalls() []struct {
	Ctx      context.Context
	EntityID string
}

DeleteEntityCalls gets all the calls that were made to DeleteEntity. Check the length with:

len(mockedContextBrokerClient.DeleteEntityCalls())

func (*ContextBrokerClientMock) MergeEntity

func (mock *ContextBrokerClientMock) MergeEntity(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.MergeEntityResult, error)

MergeEntity calls MergeEntityFunc.

func (*ContextBrokerClientMock) MergeEntityCalls

func (mock *ContextBrokerClientMock) MergeEntityCalls() []struct {
	Ctx      context.Context
	EntityID string
	Fragment types.EntityFragment
	Headers  map[string][]string
}

MergeEntityCalls gets all the calls that were made to MergeEntity. Check the length with:

len(mockedContextBrokerClient.MergeEntityCalls())

func (*ContextBrokerClientMock) QueryEntities

func (mock *ContextBrokerClientMock) QueryEntities(ctx context.Context, entityTypes []string, entityAttributes []string, query string, headers map[string][]string) (*ngsild.QueryEntitiesResult, error)

QueryEntities calls QueryEntitiesFunc.

func (*ContextBrokerClientMock) QueryEntitiesCalls

func (mock *ContextBrokerClientMock) QueryEntitiesCalls() []struct {
	Ctx              context.Context
	EntityTypes      []string
	EntityAttributes []string
	Query            string
	Headers          map[string][]string
}

QueryEntitiesCalls gets all the calls that were made to QueryEntities. Check the length with:

len(mockedContextBrokerClient.QueryEntitiesCalls())

func (*ContextBrokerClientMock) QueryTemporalEvolutionOfEntities

func (mock *ContextBrokerClientMock) QueryTemporalEvolutionOfEntities(ctx context.Context, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.QueryTemporalEntitiesResult, error)

QueryTemporalEvolutionOfEntities calls QueryTemporalEvolutionOfEntitiesFunc.

func (*ContextBrokerClientMock) QueryTemporalEvolutionOfEntitiesCalls

func (mock *ContextBrokerClientMock) QueryTemporalEvolutionOfEntitiesCalls() []struct {
	Ctx        context.Context
	Headers    map[string][]string
	Parameters []RequestDecoratorFunc
}

QueryTemporalEvolutionOfEntitiesCalls gets all the calls that were made to QueryTemporalEvolutionOfEntities. Check the length with:

len(mockedContextBrokerClient.QueryTemporalEvolutionOfEntitiesCalls())

func (*ContextBrokerClientMock) RetrieveEntity

func (mock *ContextBrokerClientMock) RetrieveEntity(ctx context.Context, entityID string, headers map[string][]string) (types.Entity, error)

RetrieveEntity calls RetrieveEntityFunc.

func (*ContextBrokerClientMock) RetrieveEntityCalls

func (mock *ContextBrokerClientMock) RetrieveEntityCalls() []struct {
	Ctx      context.Context
	EntityID string
	Headers  map[string][]string
}

RetrieveEntityCalls gets all the calls that were made to RetrieveEntity. Check the length with:

len(mockedContextBrokerClient.RetrieveEntityCalls())

func (*ContextBrokerClientMock) RetrieveTemporalEvolutionOfEntity

func (mock *ContextBrokerClientMock) RetrieveTemporalEvolutionOfEntity(ctx context.Context, entityID string, headers map[string][]string, parameters ...RequestDecoratorFunc) (*ngsild.RetrieveTemporalEvolutionOfEntityResult, error)

RetrieveTemporalEvolutionOfEntity calls RetrieveTemporalEvolutionOfEntityFunc.

func (*ContextBrokerClientMock) RetrieveTemporalEvolutionOfEntityCalls

func (mock *ContextBrokerClientMock) RetrieveTemporalEvolutionOfEntityCalls() []struct {
	Ctx        context.Context
	EntityID   string
	Headers    map[string][]string
	Parameters []RequestDecoratorFunc
}

RetrieveTemporalEvolutionOfEntityCalls gets all the calls that were made to RetrieveTemporalEvolutionOfEntity. Check the length with:

len(mockedContextBrokerClient.RetrieveTemporalEvolutionOfEntityCalls())

func (*ContextBrokerClientMock) UpdateEntityAttributes

func (mock *ContextBrokerClientMock) UpdateEntityAttributes(ctx context.Context, entityID string, fragment types.EntityFragment, headers map[string][]string) (*ngsild.UpdateEntityAttributesResult, error)

UpdateEntityAttributes calls UpdateEntityAttributesFunc.

func (*ContextBrokerClientMock) UpdateEntityAttributesCalls

func (mock *ContextBrokerClientMock) UpdateEntityAttributesCalls() []struct {
	Ctx      context.Context
	EntityID string
	Fragment types.EntityFragment
	Headers  map[string][]string
}

UpdateEntityAttributesCalls gets all the calls that were made to UpdateEntityAttributes. Check the length with:

len(mockedContextBrokerClient.UpdateEntityAttributesCalls())

Jump to

Keyboard shortcuts

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