From 2dbcd5e6b9c57b9e307cc2ba49bd4b2c1356b93e Mon Sep 17 00:00:00 2001 From: Nick Sanford Date: Wed, 13 Nov 2024 10:39:30 -0500 Subject: [PATCH] wip --- components/camera/camera.go | 6 +++--- components/camera/collectors.go | 9 +++------ components/camera/export_collectors_test.go | 10 ++++++++++ 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 components/camera/export_collectors_test.go diff --git a/components/camera/camera.go b/components/camera/camera.go index 17660ed6b5f..1cd42ca8a00 100644 --- a/components/camera/camera.go +++ b/components/camera/camera.go @@ -30,15 +30,15 @@ func init() { data.RegisterCollector(data.MethodMetadata{ API: API, MethodName: nextPointCloud.String(), - }, NewNextPointCloudCollector) + }, newNextPointCloudCollector) data.RegisterCollector(data.MethodMetadata{ API: API, MethodName: readImage.String(), - }, NewReadImageCollector) + }, newReadImageCollector) data.RegisterCollector(data.MethodMetadata{ API: API, MethodName: getImages.String(), - }, NewGetImagesCollector) + }, newGetImagesCollector) } // SubtypeName is a constant that identifies the camera resource subtype string. diff --git a/components/camera/collectors.go b/components/camera/collectors.go index ee78f65f933..37663e7335f 100644 --- a/components/camera/collectors.go +++ b/components/camera/collectors.go @@ -36,8 +36,7 @@ func (m method) String() string { return "Unknown" } -// NewNextPointCloudCollector creates a collector for camera.NextPointCloud. -func NewNextPointCloudCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { +func newNextPointCloudCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { camera, err := assertCamera(resource) if err != nil { return nil, err @@ -73,8 +72,7 @@ func NewNextPointCloudCollector(resource interface{}, params data.CollectorParam return data.NewCollector(cFunc, params) } -// NewReadImageCollector creates a collector for camera.GetImage. -func NewReadImageCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { +func newReadImageCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { camera, err := assertCamera(resource) if err != nil { return nil, err @@ -126,8 +124,7 @@ func NewReadImageCollector(resource interface{}, params data.CollectorParams) (d return data.NewCollector(cFunc, params) } -// NewGetImagesCollector creates a collector for camera.GetImages. -func NewGetImagesCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { +func newGetImagesCollector(resource interface{}, params data.CollectorParams) (data.Collector, error) { camera, err := assertCamera(resource) if err != nil { return nil, err diff --git a/components/camera/export_collectors_test.go b/components/camera/export_collectors_test.go new file mode 100644 index 00000000000..b6692840298 --- /dev/null +++ b/components/camera/export_collectors_test.go @@ -0,0 +1,10 @@ +package camera + +// export_collectors_test.go adds functionality to the package that we only want to use and expose during testing. + +// Exported variables for testing collectors, see unexported collectors for implementation details. +var ( + NewNextPointCloudCollector = newNextPointCloudCollector + NewReadImageCollector = newReadImageCollector + NewGetImagesCollector = newGetImagesCollector +)