Documentation
¶
Index ¶
- type Config
- type Storage
- type StorageMock
- func (mock *StorageMock) Query(ctx context.Context, q messagecollector.QueryParams, tenants []string) messagecollector.QueryResult
- func (mock *StorageMock) QueryCalls() []struct{ ... }
- func (mock *StorageMock) QueryDevice(ctx context.Context, deviceID string, tenants []string) messagecollector.QueryResult
- func (mock *StorageMock) QueryDeviceCalls() []struct{ ... }
- func (mock *StorageMock) QueryObject(ctx context.Context, deviceID string, urn string, tenants []string) messagecollector.QueryResult
- func (mock *StorageMock) QueryObjectCalls() []struct{ ... }
- func (mock *StorageMock) Save(ctx context.Context, m messagecollector.Measurement) error
- func (mock *StorageMock) SaveCalls() []struct{ ... }
- func (mock *StorageMock) SaveMany(ctx context.Context, m []messagecollector.Measurement) error
- func (mock *StorageMock) SaveManyCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func LoadConfiguration ¶
type Storage ¶
type Storage interface { messagecollector.MeasurementRetriever messagecollector.MeasurementStorer }
type StorageMock ¶
type StorageMock struct { // QueryFunc mocks the Query method. QueryFunc func(ctx context.Context, q messagecollector.QueryParams, tenants []string) messagecollector.QueryResult // QueryDeviceFunc mocks the QueryDevice method. QueryDeviceFunc func(ctx context.Context, deviceID string, tenants []string) messagecollector.QueryResult // QueryObjectFunc mocks the QueryObject method. QueryObjectFunc func(ctx context.Context, deviceID string, urn string, tenants []string) messagecollector.QueryResult // SaveFunc mocks the Save method. SaveFunc func(ctx context.Context, m messagecollector.Measurement) error // SaveManyFunc mocks the SaveMany method. SaveManyFunc func(ctx context.Context, m []messagecollector.Measurement) error // contains filtered or unexported fields }
StorageMock is a mock implementation of Storage.
func TestSomethingThatUsesStorage(t *testing.T) { // make and configure a mocked Storage mockedStorage := &StorageMock{ QueryFunc: func(ctx context.Context, q messagecollector.QueryParams, tenants []string) messagecollector.QueryResult { panic("mock out the Query method") }, QueryDeviceFunc: func(ctx context.Context, deviceID string, tenants []string) messagecollector.QueryResult { panic("mock out the QueryDevice method") }, QueryObjectFunc: func(ctx context.Context, deviceID string, urn string, tenants []string) messagecollector.QueryResult { panic("mock out the QueryObject method") }, SaveFunc: func(ctx context.Context, m messagecollector.Measurement) error { panic("mock out the Save method") }, SaveManyFunc: func(ctx context.Context, m []messagecollector.Measurement) error { panic("mock out the SaveMany method") }, } // use mockedStorage in code that requires Storage // and then make assertions. }
func (*StorageMock) Query ¶
func (mock *StorageMock) Query(ctx context.Context, q messagecollector.QueryParams, tenants []string) messagecollector.QueryResult
Query calls QueryFunc.
func (*StorageMock) QueryCalls ¶
func (mock *StorageMock) QueryCalls() []struct { Ctx context.Context Q messagecollector.QueryParams Tenants []string }
QueryCalls gets all the calls that were made to Query. Check the length with:
len(mockedStorage.QueryCalls())
func (*StorageMock) QueryDevice ¶
func (mock *StorageMock) QueryDevice(ctx context.Context, deviceID string, tenants []string) messagecollector.QueryResult
QueryDevice calls QueryDeviceFunc.
func (*StorageMock) QueryDeviceCalls ¶
func (mock *StorageMock) QueryDeviceCalls() []struct { Ctx context.Context DeviceID string Tenants []string }
QueryDeviceCalls gets all the calls that were made to QueryDevice. Check the length with:
len(mockedStorage.QueryDeviceCalls())
func (*StorageMock) QueryObject ¶
func (mock *StorageMock) QueryObject(ctx context.Context, deviceID string, urn string, tenants []string) messagecollector.QueryResult
QueryObject calls QueryObjectFunc.
func (*StorageMock) QueryObjectCalls ¶
func (mock *StorageMock) QueryObjectCalls() []struct { Ctx context.Context DeviceID string Urn string Tenants []string }
QueryObjectCalls gets all the calls that were made to QueryObject. Check the length with:
len(mockedStorage.QueryObjectCalls())
func (*StorageMock) Save ¶
func (mock *StorageMock) Save(ctx context.Context, m messagecollector.Measurement) error
Save calls SaveFunc.
func (*StorageMock) SaveCalls ¶
func (mock *StorageMock) SaveCalls() []struct { Ctx context.Context M messagecollector.Measurement }
SaveCalls gets all the calls that were made to Save. Check the length with:
len(mockedStorage.SaveCalls())
func (*StorageMock) SaveMany ¶
func (mock *StorageMock) SaveMany(ctx context.Context, m []messagecollector.Measurement) error
SaveMany calls SaveManyFunc.
func (*StorageMock) SaveManyCalls ¶
func (mock *StorageMock) SaveManyCalls() []struct { Ctx context.Context M []messagecollector.Measurement }
SaveManyCalls gets all the calls that were made to SaveMany. Check the length with:
len(mockedStorage.SaveManyCalls())
Click to show internal directories.
Click to hide internal directories.