regulators: Add Sensors to Services hierarchy
Add the Sensors service to the Services hierarchy:
* Add Sensors class to Services
* Add DBusSensors class to BMCServices
* Add MockSensors class to MockServices
Tested:
* DBusSensors
* Acquired DBusSensors reference from BMCServices object
* Successfully executed a sensor monitoring cycle using the reference
* MockSensors
* Acquired MockSensors reference from MockServices object
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ida06baed47c0d8711ab3acba71f67df3646ea122
diff --git a/phosphor-regulators/test/mock_services.hpp b/phosphor-regulators/test/mock_services.hpp
index b121e13..8e3a100 100644
--- a/phosphor-regulators/test/mock_services.hpp
+++ b/phosphor-regulators/test/mock_services.hpp
@@ -20,8 +20,10 @@
#include "mock_error_logging.hpp"
#include "mock_journal.hpp"
#include "mock_presence_service.hpp"
+#include "mock_sensors.hpp"
#include "mock_vpd.hpp"
#include "presence_service.hpp"
+#include "sensors.hpp"
#include "services.hpp"
#include "vpd.hpp"
@@ -70,6 +72,12 @@
return presenceService;
}
+ /** @copydoc Services::getSensors() */
+ virtual Sensors& getSensors() override
+ {
+ return sensors;
+ }
+
/** @copydoc Services::getVPD() */
virtual VPD& getVPD() override
{
@@ -115,6 +123,18 @@
}
/**
+ * Returns the MockSensors object that implements the Sensors interface.
+ *
+ * This allows test cases to use the object in EXPECT_CALL() statements.
+ *
+ * @return mock sensors interface object
+ */
+ virtual MockSensors& getMockSensors()
+ {
+ return sensors;
+ }
+
+ /**
* Returns the MockVPD object that implements the VPD interface.
*
* This allows test cases to use the object in EXPECT_CALL() statements.
@@ -148,6 +168,11 @@
MockPresenceService presenceService{};
/**
+ * Mock implementation of the Sensors interface.
+ */
+ MockSensors sensors{};
+
+ /**
* Mock implementation of the VPD interface.
*/
MockVPD vpd{};