From 2e32708ab81acdef9ec38d9db761411d2c692769 Mon Sep 17 00:00:00 2001 From: Ginny Guan Date: Tue, 19 Nov 2024 09:41:00 +0800 Subject: [PATCH] feat: change start/end from int to int64 for arm32 close #947 Signed-off-by: Ginny Guan --- clients/http/event.go | 4 +- clients/http/event_test.go | 6 +- clients/http/notification.go | 4 +- clients/http/notification_test.go | 6 +- clients/http/reading.go | 16 +-- clients/http/reading_test.go | 24 ++-- clients/http/transmission.go | 4 +- clients/http/transmission_test.go | 6 +- clients/interfaces/event.go | 2 +- clients/interfaces/mocks/EventClient.go | 79 ++++++++--- .../interfaces/mocks/NotificationClient.go | 116 +++++++++++++--- clients/interfaces/mocks/ReadingClient.go | 125 ++++++++++++++---- .../interfaces/mocks/TransmissionClient.go | 80 ++++++++--- clients/interfaces/notification.go | 2 +- clients/interfaces/reading.go | 8 +- clients/interfaces/transmission.go | 2 +- 16 files changed, 356 insertions(+), 128 deletions(-) diff --git a/clients/http/event.go b/clients/http/event.go index ef6ec4ff..4bfa9510 100644 --- a/clients/http/event.go +++ b/clients/http/event.go @@ -109,9 +109,9 @@ func (ec *eventClient) DeleteByDeviceName(ctx context.Context, name string) (dto return res, nil } -func (ec *eventClient) EventsByTimeRange(ctx context.Context, start, end, offset, limit int) ( +func (ec *eventClient) EventsByTimeRange(ctx context.Context, start, end int64, offset, limit int) ( responses.MultiEventsResponse, errors.EdgeX) { - requestPath := path.Join(common.ApiEventRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + requestPath := path.Join(common.ApiEventRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) diff --git a/clients/http/event_test.go b/clients/http/event_test.go index 0586bd00..764131d0 100644 --- a/clients/http/event_test.go +++ b/clients/http/event_test.go @@ -93,9 +93,9 @@ func TestDeleteEventsByDeviceName(t *testing.T) { } func TestQueryEventsByTimeRange(t *testing.T) { - start := 1 - end := 10 - urlPath := path.Join(common.ApiEventRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiEventRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiEventsResponse{}) defer ts.Close() diff --git a/clients/http/notification.go b/clients/http/notification.go index 380972ea..4c7380ae 100644 --- a/clients/http/notification.go +++ b/clients/http/notification.go @@ -105,8 +105,8 @@ func (client *NotificationClient) NotificationsByStatus(ctx context.Context, sta } // NotificationsByTimeRange query notifications with time range, offset and limit -func (client *NotificationClient) NotificationsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (res responses.MultiNotificationsResponse, err errors.EdgeX) { - requestPath := path.Join(common.ApiNotificationRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) +func (client *NotificationClient) NotificationsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (res responses.MultiNotificationsResponse, err errors.EdgeX) { + requestPath := path.Join(common.ApiNotificationRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) diff --git a/clients/http/notification_test.go b/clients/http/notification_test.go index 43ae105d..a5b52323 100644 --- a/clients/http/notification_test.go +++ b/clients/http/notification_test.go @@ -100,9 +100,9 @@ func TestNotificationClient_NotificationsBySubscriptionName(t *testing.T) { } func TestNotificationClient_NotificationsByTimeRange(t *testing.T) { - start := 1 - end := 10 - urlPath := path.Join(common.ApiNotificationRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiNotificationRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiNotificationsResponse{}) defer ts.Close() client := NewNotificationClient(ts.URL, NewNullAuthenticationInjector(), false) diff --git a/clients/http/reading.go b/clients/http/reading.go index 328e45ee..43865404 100644 --- a/clients/http/reading.go +++ b/clients/http/reading.go @@ -93,8 +93,8 @@ func (rc readingClient) ReadingsByResourceName(ctx context.Context, name string, return res, nil } -func (rc readingClient) ReadingsByTimeRange(ctx context.Context, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { - requestPath := path.Join(common.ApiReadingRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) +func (rc readingClient) ReadingsByTimeRange(ctx context.Context, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { + requestPath := path.Join(common.ApiReadingRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) @@ -107,9 +107,9 @@ func (rc readingClient) ReadingsByTimeRange(ctx context.Context, start, end, off } // ReadingsByResourceNameAndTimeRange returns readings by resource name and specified time range. Readings are sorted in descending order of origin time. -func (rc readingClient) ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (rc readingClient) ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { requestPath := common.NewPathBuilder().EnableNameFieldEscape(rc.enableNameFieldEscape). - SetPath(common.ApiReadingRoute).SetPath(common.ResourceName).SetNameFieldPath(name).SetPath(common.Start).SetPath(strconv.Itoa(start)).SetPath(common.End).SetPath(strconv.Itoa(end)).BuildPath() + SetPath(common.ApiReadingRoute).SetPath(common.ResourceName).SetNameFieldPath(name).SetPath(common.Start).SetPath(strconv.FormatInt(start, 10)).SetPath(common.End).SetPath(strconv.FormatInt(end, 10)).BuildPath() requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) @@ -136,10 +136,10 @@ func (rc readingClient) ReadingsByDeviceNameAndResourceName(ctx context.Context, } -func (rc readingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName, resourceName string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (rc readingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName, resourceName string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { requestPath := common.NewPathBuilder().EnableNameFieldEscape(rc.enableNameFieldEscape). SetPath(common.ApiReadingRoute).SetPath(common.Device).SetPath(common.Name).SetNameFieldPath(deviceName).SetPath(common.ResourceName).SetNameFieldPath(resourceName). - SetPath(common.Start).SetPath(strconv.Itoa(start)).SetPath(common.End).SetPath(strconv.Itoa(end)).BuildPath() + SetPath(common.Start).SetPath(strconv.FormatInt(start, 10)).SetPath(common.End).SetPath(strconv.FormatInt(end, 10)).BuildPath() requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) @@ -151,10 +151,10 @@ func (rc readingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx cont return res, nil } -func (rc readingClient) ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (rc readingClient) ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { requestPath := common.NewPathBuilder().EnableNameFieldEscape(rc.enableNameFieldEscape). SetPath(common.ApiReadingRoute).SetPath(common.Device).SetPath(common.Name).SetNameFieldPath(deviceName). - SetPath(common.Start).SetPath(strconv.Itoa(start)).SetPath(common.End).SetPath(strconv.Itoa(end)).BuildPath() + SetPath(common.Start).SetPath(strconv.FormatInt(start, 10)).SetPath(common.End).SetPath(strconv.FormatInt(end, 10)).BuildPath() requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) diff --git a/clients/http/reading_test.go b/clients/http/reading_test.go index 3ce7166f..91b13ba7 100644 --- a/clients/http/reading_test.go +++ b/clients/http/reading_test.go @@ -78,9 +78,9 @@ func TestQueryReadingsByResourceName(t *testing.T) { } func TestQueryReadingsByTimeRange(t *testing.T) { - start := 1 - end := 10 - urlPath := path.Join(common.ApiReadingRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiReadingRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiReadingsResponse{}) defer ts.Close() @@ -92,9 +92,9 @@ func TestQueryReadingsByTimeRange(t *testing.T) { func TestQueryReadingsByResourceNameAndTimeRange(t *testing.T) { resourceName := "resource" - start := 1 - end := 10 - urlPath := path.Join(common.ApiReadingRoute, common.ResourceName, resourceName, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiReadingRoute, common.ResourceName, resourceName, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiReadingsResponse{}) defer ts.Close() @@ -120,9 +120,9 @@ func TestQueryReadingsByDeviceNameAndResourceName(t *testing.T) { func TestQueryReadingsByDeviceNameAndResourceNameAndTimeRange(t *testing.T) { deviceName := "device" resourceName := "resource" - start := 1 - end := 10 - urlPath := path.Join(common.ApiReadingRoute, common.Device, common.Name, deviceName, common.ResourceName, resourceName, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiReadingRoute, common.Device, common.Name, deviceName, common.ResourceName, resourceName, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiReadingsResponse{}) defer ts.Close() @@ -135,9 +135,9 @@ func TestQueryReadingsByDeviceNameAndResourceNameAndTimeRange(t *testing.T) { func TestQueryReadingsByDeviceNameAndResourceNamesAndTimeRange(t *testing.T) { deviceName := "device" resourceNames := []string{"resource01", "resource02"} - start := 1 - end := 10 - urlPath := path.Join(common.ApiReadingRoute, common.Device, common.Name, deviceName, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiReadingRoute, common.Device, common.Name, deviceName, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiReadingsResponse{}) defer ts.Close() diff --git a/clients/http/transmission.go b/clients/http/transmission.go index 9ab8a575..81620f53 100644 --- a/clients/http/transmission.go +++ b/clients/http/transmission.go @@ -46,8 +46,8 @@ func (client *TransmissionClient) TransmissionById(ctx context.Context, id strin } // TransmissionsByTimeRange query transmissions with time range, offset and limit -func (client *TransmissionClient) TransmissionsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (res responses.MultiTransmissionsResponse, err errors.EdgeX) { - requestPath := path.Join(common.ApiTransmissionRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) +func (client *TransmissionClient) TransmissionsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (res responses.MultiTransmissionsResponse, err errors.EdgeX) { + requestPath := path.Join(common.ApiTransmissionRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) requestParams := url.Values{} requestParams.Set(common.Offset, strconv.Itoa(offset)) requestParams.Set(common.Limit, strconv.Itoa(limit)) diff --git a/clients/http/transmission_test.go b/clients/http/transmission_test.go index fde990c0..ad91a4aa 100644 --- a/clients/http/transmission_test.go +++ b/clients/http/transmission_test.go @@ -75,9 +75,9 @@ func TestTransmissionClient_TransmissionsBySubscriptionName(t *testing.T) { } func TestTransmissionClient_TransmissionsByTimeRange(t *testing.T) { - start := 1 - end := 10 - urlPath := path.Join(common.ApiTransmissionRoute, common.Start, strconv.Itoa(start), common.End, strconv.Itoa(end)) + start := int64(1) + end := int64(10) + urlPath := path.Join(common.ApiTransmissionRoute, common.Start, strconv.FormatInt(start, 10), common.End, strconv.FormatInt(end, 10)) ts := newTestServer(http.MethodGet, urlPath, responses.MultiTransmissionsResponse{}) defer ts.Close() client := NewTransmissionClient(ts.URL, NewNullAuthenticationInjector(), false) diff --git a/clients/interfaces/event.go b/clients/interfaces/event.go index 8d9c95c7..3a6526b2 100644 --- a/clients/interfaces/event.go +++ b/clients/interfaces/event.go @@ -37,7 +37,7 @@ type EventClient interface { // start, end: Unix timestamp, indicating the date/time range. // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. - EventsByTimeRange(ctx context.Context, start, end, offset, limit int) (responses.MultiEventsResponse, errors.EdgeX) + EventsByTimeRange(ctx context.Context, start, end int64, offset, limit int) (responses.MultiEventsResponse, errors.EdgeX) // DeleteByAge deletes events that are older than the given age. Age is supposed in milliseconds from created timestamp. DeleteByAge(ctx context.Context, age int) (common.BaseResponse, errors.EdgeX) // DeleteById deletes an event by its id diff --git a/clients/interfaces/mocks/EventClient.go b/clients/interfaces/mocks/EventClient.go index 5fd59a82..319fa90b 100644 --- a/clients/interfaces/mocks/EventClient.go +++ b/clients/interfaces/mocks/EventClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.2. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -25,6 +25,10 @@ type EventClient struct { func (_m *EventClient) Add(ctx context.Context, serviceName string, req requests.AddEventRequest) (common.BaseWithIdResponse, errors.EdgeX) { ret := _m.Called(ctx, serviceName, req) + if len(ret) == 0 { + panic("no return value specified for Add") + } + var r0 common.BaseWithIdResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, string, requests.AddEventRequest) (common.BaseWithIdResponse, errors.EdgeX)); ok { @@ -51,6 +55,10 @@ func (_m *EventClient) Add(ctx context.Context, serviceName string, req requests func (_m *EventClient) AllEvents(ctx context.Context, offset int, limit int) (responses.MultiEventsResponse, errors.EdgeX) { ret := _m.Called(ctx, offset, limit) + if len(ret) == 0 { + panic("no return value specified for AllEvents") + } + var r0 responses.MultiEventsResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, int, int) (responses.MultiEventsResponse, errors.EdgeX)); ok { @@ -77,6 +85,10 @@ func (_m *EventClient) AllEvents(ctx context.Context, offset int, limit int) (re func (_m *EventClient) DeleteByAge(ctx context.Context, age int) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx, age) + if len(ret) == 0 { + panic("no return value specified for DeleteByAge") + } + var r0 common.BaseResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, int) (common.BaseResponse, errors.EdgeX)); ok { @@ -99,23 +111,27 @@ func (_m *EventClient) DeleteByAge(ctx context.Context, age int) (common.BaseRes return r0, r1 } -// DeleteById provides a mock function with given fields: ctx, id -func (_m *EventClient) DeleteById(ctx context.Context, id string) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, id) +// DeleteByDeviceName provides a mock function with given fields: ctx, name +func (_m *EventClient) DeleteByDeviceName(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) { + ret := _m.Called(ctx, name) + + if len(ret) == 0 { + panic("no return value specified for DeleteByDeviceName") + } var r0 common.BaseResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, string) (common.BaseResponse, errors.EdgeX)); ok { - return rf(ctx, id) + return rf(ctx, name) } if rf, ok := ret.Get(0).(func(context.Context, string) common.BaseResponse); ok { - r0 = rf(ctx, id) + r0 = rf(ctx, name) } else { r0 = ret.Get(0).(common.BaseResponse) } if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { - r1 = rf(ctx, id) + r1 = rf(ctx, name) } else { if ret.Get(1) != nil { r1 = ret.Get(1).(errors.EdgeX) @@ -125,23 +141,27 @@ func (_m *EventClient) DeleteById(ctx context.Context, id string) (common.BaseRe return r0, r1 } -// DeleteByDeviceName provides a mock function with given fields: ctx, name -func (_m *EventClient) DeleteByDeviceName(ctx context.Context, name string) (common.BaseResponse, errors.EdgeX) { - ret := _m.Called(ctx, name) +// DeleteById provides a mock function with given fields: ctx, id +func (_m *EventClient) DeleteById(ctx context.Context, id string) (common.BaseResponse, errors.EdgeX) { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for DeleteById") + } var r0 common.BaseResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, string) (common.BaseResponse, errors.EdgeX)); ok { - return rf(ctx, name) + return rf(ctx, id) } if rf, ok := ret.Get(0).(func(context.Context, string) common.BaseResponse); ok { - r0 = rf(ctx, name) + r0 = rf(ctx, id) } else { r0 = ret.Get(0).(common.BaseResponse) } if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { - r1 = rf(ctx, name) + r1 = rf(ctx, id) } else { if ret.Get(1) != nil { r1 = ret.Get(1).(errors.EdgeX) @@ -155,6 +175,10 @@ func (_m *EventClient) DeleteByDeviceName(ctx context.Context, name string) (com func (_m *EventClient) EventCount(ctx context.Context) (common.CountResponse, errors.EdgeX) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for EventCount") + } + var r0 common.CountResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context) (common.CountResponse, errors.EdgeX)); ok { @@ -181,6 +205,10 @@ func (_m *EventClient) EventCount(ctx context.Context) (common.CountResponse, er func (_m *EventClient) EventCountByDeviceName(ctx context.Context, name string) (common.CountResponse, errors.EdgeX) { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for EventCountByDeviceName") + } + var r0 common.CountResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, string) (common.CountResponse, errors.EdgeX)); ok { @@ -207,6 +235,10 @@ func (_m *EventClient) EventCountByDeviceName(ctx context.Context, name string) func (_m *EventClient) EventsByDeviceName(ctx context.Context, name string, offset int, limit int) (responses.MultiEventsResponse, errors.EdgeX) { ret := _m.Called(ctx, name, offset, limit) + if len(ret) == 0 { + panic("no return value specified for EventsByDeviceName") + } + var r0 responses.MultiEventsResponse var r1 errors.EdgeX if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiEventsResponse, errors.EdgeX)); ok { @@ -230,21 +262,25 @@ func (_m *EventClient) EventsByDeviceName(ctx context.Context, name string, offs } // EventsByTimeRange provides a mock function with given fields: ctx, start, end, offset, limit -func (_m *EventClient) EventsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiEventsResponse, errors.EdgeX) { +func (_m *EventClient) EventsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (responses.MultiEventsResponse, errors.EdgeX) { ret := _m.Called(ctx, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for EventsByTimeRange") + } + var r0 responses.MultiEventsResponse var r1 errors.EdgeX - if rf, ok := ret.Get(0).(func(context.Context, int, int, int, int) (responses.MultiEventsResponse, errors.EdgeX)); ok { + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) (responses.MultiEventsResponse, errors.EdgeX)); ok { return rf(ctx, start, end, offset, limit) } - if rf, ok := ret.Get(0).(func(context.Context, int, int, int, int) responses.MultiEventsResponse); ok { + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) responses.MultiEventsResponse); ok { r0 = rf(ctx, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiEventsResponse) } - if rf, ok := ret.Get(1).(func(context.Context, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -255,13 +291,12 @@ func (_m *EventClient) EventsByTimeRange(ctx context.Context, start int, end int return r0, r1 } -type mockConstructorTestingTNewEventClient interface { +// NewEventClient creates a new instance of EventClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewEventClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewEventClient creates a new instance of EventClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewEventClient(t mockConstructorTestingTNewEventClient) *EventClient { +}) *EventClient { mock := &EventClient{} mock.Mock.Test(t) diff --git a/clients/interfaces/mocks/NotificationClient.go b/clients/interfaces/mocks/NotificationClient.go index b96a84bb..378eb003 100644 --- a/clients/interfaces/mocks/NotificationClient.go +++ b/clients/interfaces/mocks/NotificationClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -25,14 +25,21 @@ type NotificationClient struct { func (_m *NotificationClient) CleanupNotifications(ctx context.Context) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for CleanupNotifications") + } + var r0 common.BaseResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context) (common.BaseResponse, errors.EdgeX)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) common.BaseResponse); ok { r0 = rf(ctx) } else { r0 = ret.Get(0).(common.BaseResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context) errors.EdgeX); ok { r1 = rf(ctx) } else { @@ -48,14 +55,21 @@ func (_m *NotificationClient) CleanupNotifications(ctx context.Context) (common. func (_m *NotificationClient) CleanupNotificationsByAge(ctx context.Context, age int) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx, age) + if len(ret) == 0 { + panic("no return value specified for CleanupNotificationsByAge") + } + var r0 common.BaseResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int) (common.BaseResponse, errors.EdgeX)); ok { + return rf(ctx, age) + } if rf, ok := ret.Get(0).(func(context.Context, int) common.BaseResponse); ok { r0 = rf(ctx, age) } else { r0 = ret.Get(0).(common.BaseResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, int) errors.EdgeX); ok { r1 = rf(ctx, age) } else { @@ -71,14 +85,21 @@ func (_m *NotificationClient) CleanupNotificationsByAge(ctx context.Context, age func (_m *NotificationClient) DeleteNotificationById(ctx context.Context, id string) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for DeleteNotificationById") + } + var r0 common.BaseResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string) (common.BaseResponse, errors.EdgeX)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) common.BaseResponse); ok { r0 = rf(ctx, id) } else { r0 = ret.Get(0).(common.BaseResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { r1 = rf(ctx, id) } else { @@ -94,14 +115,21 @@ func (_m *NotificationClient) DeleteNotificationById(ctx context.Context, id str func (_m *NotificationClient) DeleteProcessedNotificationsByAge(ctx context.Context, age int) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx, age) + if len(ret) == 0 { + panic("no return value specified for DeleteProcessedNotificationsByAge") + } + var r0 common.BaseResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int) (common.BaseResponse, errors.EdgeX)); ok { + return rf(ctx, age) + } if rf, ok := ret.Get(0).(func(context.Context, int) common.BaseResponse); ok { r0 = rf(ctx, age) } else { r0 = ret.Get(0).(common.BaseResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, int) errors.EdgeX); ok { r1 = rf(ctx, age) } else { @@ -117,14 +145,21 @@ func (_m *NotificationClient) DeleteProcessedNotificationsByAge(ctx context.Cont func (_m *NotificationClient) NotificationById(ctx context.Context, id string) (responses.NotificationResponse, errors.EdgeX) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for NotificationById") + } + var r0 responses.NotificationResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string) (responses.NotificationResponse, errors.EdgeX)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) responses.NotificationResponse); ok { r0 = rf(ctx, id) } else { r0 = ret.Get(0).(responses.NotificationResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { r1 = rf(ctx, id) } else { @@ -140,14 +175,21 @@ func (_m *NotificationClient) NotificationById(ctx context.Context, id string) ( func (_m *NotificationClient) NotificationsByCategory(ctx context.Context, category string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { ret := _m.Called(ctx, category, offset, limit) + if len(ret) == 0 { + panic("no return value specified for NotificationsByCategory") + } + var r0 responses.MultiNotificationsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiNotificationsResponse, errors.EdgeX)); ok { + return rf(ctx, category, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiNotificationsResponse); ok { r0 = rf(ctx, category, offset, limit) } else { r0 = ret.Get(0).(responses.MultiNotificationsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, category, offset, limit) } else { @@ -163,14 +205,21 @@ func (_m *NotificationClient) NotificationsByCategory(ctx context.Context, categ func (_m *NotificationClient) NotificationsByLabel(ctx context.Context, label string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { ret := _m.Called(ctx, label, offset, limit) + if len(ret) == 0 { + panic("no return value specified for NotificationsByLabel") + } + var r0 responses.MultiNotificationsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiNotificationsResponse, errors.EdgeX)); ok { + return rf(ctx, label, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiNotificationsResponse); ok { r0 = rf(ctx, label, offset, limit) } else { r0 = ret.Get(0).(responses.MultiNotificationsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, label, offset, limit) } else { @@ -186,14 +235,21 @@ func (_m *NotificationClient) NotificationsByLabel(ctx context.Context, label st func (_m *NotificationClient) NotificationsByStatus(ctx context.Context, status string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { ret := _m.Called(ctx, status, offset, limit) + if len(ret) == 0 { + panic("no return value specified for NotificationsByStatus") + } + var r0 responses.MultiNotificationsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiNotificationsResponse, errors.EdgeX)); ok { + return rf(ctx, status, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiNotificationsResponse); ok { r0 = rf(ctx, status, offset, limit) } else { r0 = ret.Get(0).(responses.MultiNotificationsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, status, offset, limit) } else { @@ -209,14 +265,21 @@ func (_m *NotificationClient) NotificationsByStatus(ctx context.Context, status func (_m *NotificationClient) NotificationsBySubscriptionName(ctx context.Context, subscriptionName string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { ret := _m.Called(ctx, subscriptionName, offset, limit) + if len(ret) == 0 { + panic("no return value specified for NotificationsBySubscriptionName") + } + var r0 responses.MultiNotificationsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiNotificationsResponse, errors.EdgeX)); ok { + return rf(ctx, subscriptionName, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiNotificationsResponse); ok { r0 = rf(ctx, subscriptionName, offset, limit) } else { r0 = ret.Get(0).(responses.MultiNotificationsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, subscriptionName, offset, limit) } else { @@ -229,18 +292,25 @@ func (_m *NotificationClient) NotificationsBySubscriptionName(ctx context.Contex } // NotificationsByTimeRange provides a mock function with given fields: ctx, start, end, offset, limit -func (_m *NotificationClient) NotificationsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { +func (_m *NotificationClient) NotificationsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) { ret := _m.Called(ctx, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for NotificationsByTimeRange") + } + var r0 responses.MultiNotificationsResponse - if rf, ok := ret.Get(0).(func(context.Context, int, int, int, int) responses.MultiNotificationsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) (responses.MultiNotificationsResponse, errors.EdgeX)); ok { + return rf(ctx, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) responses.MultiNotificationsResponse); ok { r0 = rf(ctx, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiNotificationsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -255,7 +325,15 @@ func (_m *NotificationClient) NotificationsByTimeRange(ctx context.Context, star func (_m *NotificationClient) SendNotification(ctx context.Context, reqs []requests.AddNotificationRequest) ([]common.BaseWithIdResponse, errors.EdgeX) { ret := _m.Called(ctx, reqs) + if len(ret) == 0 { + panic("no return value specified for SendNotification") + } + var r0 []common.BaseWithIdResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, []requests.AddNotificationRequest) ([]common.BaseWithIdResponse, errors.EdgeX)); ok { + return rf(ctx, reqs) + } if rf, ok := ret.Get(0).(func(context.Context, []requests.AddNotificationRequest) []common.BaseWithIdResponse); ok { r0 = rf(ctx, reqs) } else { @@ -264,7 +342,6 @@ func (_m *NotificationClient) SendNotification(ctx context.Context, reqs []reque } } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, []requests.AddNotificationRequest) errors.EdgeX); ok { r1 = rf(ctx, reqs) } else { @@ -276,13 +353,12 @@ func (_m *NotificationClient) SendNotification(ctx context.Context, reqs []reque return r0, r1 } -type mockConstructorTestingTNewNotificationClient interface { +// NewNotificationClient creates a new instance of NotificationClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewNotificationClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewNotificationClient creates a new instance of NotificationClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNotificationClient(t mockConstructorTestingTNewNotificationClient) *NotificationClient { +}) *NotificationClient { mock := &NotificationClient{} mock.Mock.Test(t) diff --git a/clients/interfaces/mocks/ReadingClient.go b/clients/interfaces/mocks/ReadingClient.go index fbbef3a2..fb478b93 100644 --- a/clients/interfaces/mocks/ReadingClient.go +++ b/clients/interfaces/mocks/ReadingClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -23,14 +23,21 @@ type ReadingClient struct { func (_m *ReadingClient) AllReadings(ctx context.Context, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, offset, limit) + if len(ret) == 0 { + panic("no return value specified for AllReadings") + } + var r0 responses.MultiReadingsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, int, int) errors.EdgeX); ok { r1 = rf(ctx, offset, limit) } else { @@ -46,14 +53,21 @@ func (_m *ReadingClient) AllReadings(ctx context.Context, offset int, limit int) func (_m *ReadingClient) ReadingCount(ctx context.Context) (common.CountResponse, errors.EdgeX) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for ReadingCount") + } + var r0 common.CountResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context) (common.CountResponse, errors.EdgeX)); ok { + return rf(ctx) + } if rf, ok := ret.Get(0).(func(context.Context) common.CountResponse); ok { r0 = rf(ctx) } else { r0 = ret.Get(0).(common.CountResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context) errors.EdgeX); ok { r1 = rf(ctx) } else { @@ -69,14 +83,21 @@ func (_m *ReadingClient) ReadingCount(ctx context.Context) (common.CountResponse func (_m *ReadingClient) ReadingCountByDeviceName(ctx context.Context, name string) (common.CountResponse, errors.EdgeX) { ret := _m.Called(ctx, name) + if len(ret) == 0 { + panic("no return value specified for ReadingCountByDeviceName") + } + var r0 common.CountResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string) (common.CountResponse, errors.EdgeX)); ok { + return rf(ctx, name) + } if rf, ok := ret.Get(0).(func(context.Context, string) common.CountResponse); ok { r0 = rf(ctx, name) } else { r0 = ret.Get(0).(common.CountResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { r1 = rf(ctx, name) } else { @@ -92,14 +113,21 @@ func (_m *ReadingClient) ReadingCountByDeviceName(ctx context.Context, name stri func (_m *ReadingClient) ReadingsByDeviceName(ctx context.Context, name string, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, name, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByDeviceName") + } + var r0 responses.MultiReadingsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, name, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, name, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, name, offset, limit) } else { @@ -115,14 +143,21 @@ func (_m *ReadingClient) ReadingsByDeviceName(ctx context.Context, name string, func (_m *ReadingClient) ReadingsByDeviceNameAndResourceName(ctx context.Context, deviceName string, resourceName string, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, deviceName, resourceName, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByDeviceNameAndResourceName") + } + var r0 responses.MultiReadingsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, string, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, deviceName, resourceName, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, string, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, deviceName, resourceName, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, deviceName, resourceName, offset, limit) } else { @@ -135,18 +170,25 @@ func (_m *ReadingClient) ReadingsByDeviceNameAndResourceName(ctx context.Context } // ReadingsByDeviceNameAndResourceNameAndTimeRange provides a mock function with given fields: ctx, deviceName, resourceName, start, end, offset, limit -func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName string, resourceName string, start int, end int, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName string, resourceName string, start int64, end int64, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, deviceName, resourceName, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByDeviceNameAndResourceNameAndTimeRange") + } + var r0 responses.MultiReadingsResponse - if rf, ok := ret.Get(0).(func(context.Context, string, string, int, int, int, int) responses.MultiReadingsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, int64, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, deviceName, resourceName, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string, int64, int64, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, deviceName, resourceName, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, string, string, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, string, string, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, deviceName, resourceName, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -158,18 +200,25 @@ func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx con } // ReadingsByDeviceNameAndResourceNamesAndTimeRange provides a mock function with given fields: ctx, deviceName, resourceNames, start, end, offset, limit -func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start int, end int, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start int64, end int64, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, deviceName, resourceNames, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByDeviceNameAndResourceNamesAndTimeRange") + } + var r0 responses.MultiReadingsResponse - if rf, ok := ret.Get(0).(func(context.Context, string, []string, int, int, int, int) responses.MultiReadingsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, []string, int64, int64, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, deviceName, resourceNames, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, string, []string, int64, int64, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, deviceName, resourceNames, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, string, []string, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, string, []string, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, deviceName, resourceNames, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -184,14 +233,21 @@ func (_m *ReadingClient) ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx co func (_m *ReadingClient) ReadingsByResourceName(ctx context.Context, name string, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, name, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByResourceName") + } + var r0 responses.MultiReadingsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, name, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, name, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, name, offset, limit) } else { @@ -204,18 +260,25 @@ func (_m *ReadingClient) ReadingsByResourceName(ctx context.Context, name string } // ReadingsByResourceNameAndTimeRange provides a mock function with given fields: ctx, name, start, end, offset, limit -func (_m *ReadingClient) ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start int, end int, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (_m *ReadingClient) ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start int64, end int64, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, name, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByResourceNameAndTimeRange") + } + var r0 responses.MultiReadingsResponse - if rf, ok := ret.Get(0).(func(context.Context, string, int, int, int, int) responses.MultiReadingsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int64, int64, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, name, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, string, int64, int64, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, name, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, string, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, string, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, name, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -227,18 +290,25 @@ func (_m *ReadingClient) ReadingsByResourceNameAndTimeRange(ctx context.Context, } // ReadingsByTimeRange provides a mock function with given fields: ctx, start, end, offset, limit -func (_m *ReadingClient) ReadingsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { +func (_m *ReadingClient) ReadingsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (responses.MultiReadingsResponse, errors.EdgeX) { ret := _m.Called(ctx, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for ReadingsByTimeRange") + } + var r0 responses.MultiReadingsResponse - if rf, ok := ret.Get(0).(func(context.Context, int, int, int, int) responses.MultiReadingsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) (responses.MultiReadingsResponse, errors.EdgeX)); ok { + return rf(ctx, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) responses.MultiReadingsResponse); ok { r0 = rf(ctx, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiReadingsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -249,13 +319,12 @@ func (_m *ReadingClient) ReadingsByTimeRange(ctx context.Context, start int, end return r0, r1 } -type mockConstructorTestingTNewReadingClient interface { +// NewReadingClient creates a new instance of ReadingClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewReadingClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewReadingClient creates a new instance of ReadingClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewReadingClient(t mockConstructorTestingTNewReadingClient) *ReadingClient { +}) *ReadingClient { mock := &ReadingClient{} mock.Mock.Test(t) diff --git a/clients/interfaces/mocks/TransmissionClient.go b/clients/interfaces/mocks/TransmissionClient.go index 61bf2699..a098f7f5 100644 --- a/clients/interfaces/mocks/TransmissionClient.go +++ b/clients/interfaces/mocks/TransmissionClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.15.0. DO NOT EDIT. +// Code generated by mockery v2.45.0. DO NOT EDIT. package mocks @@ -23,14 +23,21 @@ type TransmissionClient struct { func (_m *TransmissionClient) AllTransmissions(ctx context.Context, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { ret := _m.Called(ctx, offset, limit) + if len(ret) == 0 { + panic("no return value specified for AllTransmissions") + } + var r0 responses.MultiTransmissionsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int, int) (responses.MultiTransmissionsResponse, errors.EdgeX)); ok { + return rf(ctx, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, int, int) responses.MultiTransmissionsResponse); ok { r0 = rf(ctx, offset, limit) } else { r0 = ret.Get(0).(responses.MultiTransmissionsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, int, int) errors.EdgeX); ok { r1 = rf(ctx, offset, limit) } else { @@ -46,14 +53,21 @@ func (_m *TransmissionClient) AllTransmissions(ctx context.Context, offset int, func (_m *TransmissionClient) DeleteProcessedTransmissionsByAge(ctx context.Context, age int) (common.BaseResponse, errors.EdgeX) { ret := _m.Called(ctx, age) + if len(ret) == 0 { + panic("no return value specified for DeleteProcessedTransmissionsByAge") + } + var r0 common.BaseResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int) (common.BaseResponse, errors.EdgeX)); ok { + return rf(ctx, age) + } if rf, ok := ret.Get(0).(func(context.Context, int) common.BaseResponse); ok { r0 = rf(ctx, age) } else { r0 = ret.Get(0).(common.BaseResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, int) errors.EdgeX); ok { r1 = rf(ctx, age) } else { @@ -69,14 +83,21 @@ func (_m *TransmissionClient) DeleteProcessedTransmissionsByAge(ctx context.Cont func (_m *TransmissionClient) TransmissionById(ctx context.Context, id string) (responses.TransmissionResponse, errors.EdgeX) { ret := _m.Called(ctx, id) + if len(ret) == 0 { + panic("no return value specified for TransmissionById") + } + var r0 responses.TransmissionResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string) (responses.TransmissionResponse, errors.EdgeX)); ok { + return rf(ctx, id) + } if rf, ok := ret.Get(0).(func(context.Context, string) responses.TransmissionResponse); ok { r0 = rf(ctx, id) } else { r0 = ret.Get(0).(responses.TransmissionResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string) errors.EdgeX); ok { r1 = rf(ctx, id) } else { @@ -92,14 +113,21 @@ func (_m *TransmissionClient) TransmissionById(ctx context.Context, id string) ( func (_m *TransmissionClient) TransmissionsByNotificationId(ctx context.Context, id string, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { ret := _m.Called(ctx, id, offset, limit) + if len(ret) == 0 { + panic("no return value specified for TransmissionsByNotificationId") + } + var r0 responses.MultiTransmissionsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiTransmissionsResponse, errors.EdgeX)); ok { + return rf(ctx, id, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiTransmissionsResponse); ok { r0 = rf(ctx, id, offset, limit) } else { r0 = ret.Get(0).(responses.MultiTransmissionsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, id, offset, limit) } else { @@ -115,14 +143,21 @@ func (_m *TransmissionClient) TransmissionsByNotificationId(ctx context.Context, func (_m *TransmissionClient) TransmissionsByStatus(ctx context.Context, status string, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { ret := _m.Called(ctx, status, offset, limit) + if len(ret) == 0 { + panic("no return value specified for TransmissionsByStatus") + } + var r0 responses.MultiTransmissionsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiTransmissionsResponse, errors.EdgeX)); ok { + return rf(ctx, status, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiTransmissionsResponse); ok { r0 = rf(ctx, status, offset, limit) } else { r0 = ret.Get(0).(responses.MultiTransmissionsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, status, offset, limit) } else { @@ -138,14 +173,21 @@ func (_m *TransmissionClient) TransmissionsByStatus(ctx context.Context, status func (_m *TransmissionClient) TransmissionsBySubscriptionName(ctx context.Context, subscriptionName string, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { ret := _m.Called(ctx, subscriptionName, offset, limit) + if len(ret) == 0 { + panic("no return value specified for TransmissionsBySubscriptionName") + } + var r0 responses.MultiTransmissionsResponse + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, string, int, int) (responses.MultiTransmissionsResponse, errors.EdgeX)); ok { + return rf(ctx, subscriptionName, offset, limit) + } if rf, ok := ret.Get(0).(func(context.Context, string, int, int) responses.MultiTransmissionsResponse); ok { r0 = rf(ctx, subscriptionName, offset, limit) } else { r0 = ret.Get(0).(responses.MultiTransmissionsResponse) } - var r1 errors.EdgeX if rf, ok := ret.Get(1).(func(context.Context, string, int, int) errors.EdgeX); ok { r1 = rf(ctx, subscriptionName, offset, limit) } else { @@ -158,18 +200,25 @@ func (_m *TransmissionClient) TransmissionsBySubscriptionName(ctx context.Contex } // TransmissionsByTimeRange provides a mock function with given fields: ctx, start, end, offset, limit -func (_m *TransmissionClient) TransmissionsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { +func (_m *TransmissionClient) TransmissionsByTimeRange(ctx context.Context, start int64, end int64, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) { ret := _m.Called(ctx, start, end, offset, limit) + if len(ret) == 0 { + panic("no return value specified for TransmissionsByTimeRange") + } + var r0 responses.MultiTransmissionsResponse - if rf, ok := ret.Get(0).(func(context.Context, int, int, int, int) responses.MultiTransmissionsResponse); ok { + var r1 errors.EdgeX + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) (responses.MultiTransmissionsResponse, errors.EdgeX)); ok { + return rf(ctx, start, end, offset, limit) + } + if rf, ok := ret.Get(0).(func(context.Context, int64, int64, int, int) responses.MultiTransmissionsResponse); ok { r0 = rf(ctx, start, end, offset, limit) } else { r0 = ret.Get(0).(responses.MultiTransmissionsResponse) } - var r1 errors.EdgeX - if rf, ok := ret.Get(1).(func(context.Context, int, int, int, int) errors.EdgeX); ok { + if rf, ok := ret.Get(1).(func(context.Context, int64, int64, int, int) errors.EdgeX); ok { r1 = rf(ctx, start, end, offset, limit) } else { if ret.Get(1) != nil { @@ -180,13 +229,12 @@ func (_m *TransmissionClient) TransmissionsByTimeRange(ctx context.Context, star return r0, r1 } -type mockConstructorTestingTNewTransmissionClient interface { +// NewTransmissionClient creates a new instance of TransmissionClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewTransmissionClient(t interface { mock.TestingT Cleanup(func()) -} - -// NewTransmissionClient creates a new instance of TransmissionClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewTransmissionClient(t mockConstructorTestingTNewTransmissionClient) *TransmissionClient { +}) *TransmissionClient { mock := &TransmissionClient{} mock.Mock.Test(t) diff --git a/clients/interfaces/notification.go b/clients/interfaces/notification.go index 1d3383f6..bd5557a9 100644 --- a/clients/interfaces/notification.go +++ b/clients/interfaces/notification.go @@ -29,7 +29,7 @@ type NotificationClient interface { // NotificationsByStatus queries notifications with status, offset and limit NotificationsByStatus(ctx context.Context, status string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) // NotificationsByTimeRange query notifications with time range, offset and limit - NotificationsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) + NotificationsByTimeRange(ctx context.Context, start, end int64, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) // NotificationsBySubscriptionName query notifications with subscriptionName, offset and limit NotificationsBySubscriptionName(ctx context.Context, subscriptionName string, offset int, limit int) (responses.MultiNotificationsResponse, errors.EdgeX) // CleanupNotificationsByAge removes notifications that are older than age. And the corresponding transmissions will also be deleted. diff --git a/clients/interfaces/reading.go b/clients/interfaces/reading.go index 09812b48..dc55a7c1 100644 --- a/clients/interfaces/reading.go +++ b/clients/interfaces/reading.go @@ -36,12 +36,12 @@ type ReadingClient interface { // start, end: Unix timestamp, indicating the date/time range. // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. - ReadingsByTimeRange(ctx context.Context, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) + ReadingsByTimeRange(ctx context.Context, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) // ReadingsByResourceNameAndTimeRange returns readings by resource name and specified time range. Readings are sorted in descending order of origin time. // start, end: Unix timestamp, indicating the date/time range // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. - ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) + ReadingsByResourceNameAndTimeRange(ctx context.Context, name string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) // ReadingsByDeviceNameAndResourceName returns readings by device name and resource name. Readings are sorted in descending order of origin time. // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. @@ -50,11 +50,11 @@ type ReadingClient interface { // start, end: Unix timestamp, indicating the date/time range // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. - ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName, resourceName string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) + ReadingsByDeviceNameAndResourceNameAndTimeRange(ctx context.Context, deviceName, resourceName string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) // ReadingsByDeviceNameAndResourceNamesAndTimeRange returns readings by device name, multiple resource names and specified time range. Readings are sorted in descending order of origin time. // If none of resourceNames is specified, return all Readings under specified deviceName and within specified time range // start, end: Unix timestamp, indicating the date/time range // offset: The number of items to skip before starting to collect the result set. Default is 0. // limit: The number of items to return. Specify -1 will return all remaining items after offset. The maximum will be the MaxResultCount as defined in the configuration of service. Default is 20. - ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start, end, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) + ReadingsByDeviceNameAndResourceNamesAndTimeRange(ctx context.Context, deviceName string, resourceNames []string, start, end int64, offset, limit int) (responses.MultiReadingsResponse, errors.EdgeX) } diff --git a/clients/interfaces/transmission.go b/clients/interfaces/transmission.go index db506143..2affe7e3 100644 --- a/clients/interfaces/transmission.go +++ b/clients/interfaces/transmission.go @@ -18,7 +18,7 @@ type TransmissionClient interface { // TransmissionById query transmission by id. TransmissionById(ctx context.Context, id string) (responses.TransmissionResponse, errors.EdgeX) // TransmissionsByTimeRange query transmissions with time range, offset and limit - TransmissionsByTimeRange(ctx context.Context, start int, end int, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) + TransmissionsByTimeRange(ctx context.Context, start, end int64, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) // AllTransmissions query transmissions with offset and limit AllTransmissions(ctx context.Context, offset int, limit int) (responses.MultiTransmissionsResponse, errors.EdgeX) // TransmissionsByStatus queries transmissions with status, offset and limit