regulators: Modify monitorSensors() to use Services

Modify the monitorSensors() method in the System, Chassis, Device, and
Rail classes to have a new first parameter: Services& services.

Modify SensorMonitoring::execute() to log messages using the new
Journal interface.

Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I05820cfa94bc3d15dee7a1714a3d253720aa7f92
diff --git a/phosphor-regulators/test/chassis_tests.cpp b/phosphor-regulators/test/chassis_tests.cpp
index 639dc33..08304d3 100644
--- a/phosphor-regulators/test/chassis_tests.cpp
+++ b/phosphor-regulators/test/chassis_tests.cpp
@@ -301,6 +301,12 @@
 {
     // Test where no devices were specified in constructor
     {
+        // Create mock services.  No logging should occur.
+        MockServices services{};
+        MockJournal& journal = services.getMockJournal();
+        EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
+        EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
+
         // Create Chassis
         std::vector<std::unique_ptr<Device>> devices{};
         std::unique_ptr<Chassis> chassis =
@@ -314,14 +320,17 @@
         System system{std::move(rules), std::move(chassisVec)};
 
         // Call monitorSensors().  Should do nothing.
-        journal::clear();
-        chassisPtr->monitorSensors(system);
-        EXPECT_EQ(journal::getDebugMessages().size(), 0);
-        EXPECT_EQ(journal::getErrMessages().size(), 0);
+        chassisPtr->monitorSensors(services, system);
     }
 
     // Test where devices were specified in constructor
     {
+        // Create mock services.  No logging should occur.
+        MockServices services{};
+        MockJournal& journal = services.getMockJournal();
+        EXPECT_CALL(journal, logDebug(A<const std::string&>())).Times(0);
+        EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
+
         std::vector<std::unique_ptr<Device>> devices{};
 
         // Create PMBusReadSensorAction
@@ -375,9 +384,6 @@
         System system{std::move(rules), std::move(chassisVec)};
 
         // Call monitorSensors()
-        journal::clear();
-        chassisPtr->monitorSensors(system);
-        EXPECT_EQ(journal::getDebugMessages().size(), 0);
-        EXPECT_EQ(journal::getErrMessages().size(), 0);
+        chassisPtr->monitorSensors(services, system);
     }
 }