Trigger: make dbus properties writable

This change allows to modify 'Sensors', 'ReportNames' and 'Thresholds'
dbus properties of Trigger interface. They are required by Redfish to
implement PATCH functionality for Trigger schema.

Some backend changes were required to enable this functionality, and as
such few improvements were made for existing code:
- NumericThreshold and DiscreteThreshold now have common implementation
  where it was possible.
- Internal sensor info structure for Trigger is now the same as the one
  used for Report. This resulted in breaking compatibility with previous
  Trigger persistency data.
- Added getInfo / getParams methods for Sensor and Threshold interfaces.
  They are used by Trigger dbus getters and persistency mechanism now,
  instead of storing this data in Trigger object.

Testing done:
- Unit tests were expanded and are passing
- dbus setters for Sensors and Thresholds are working and modifications
  are reflected by calling appropriate getters.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I7a14c15a30d78ce872342b5f938aba43c77be9c0
diff --git a/tests/src/test_numeric_threshold.cpp b/tests/src/test_numeric_threshold.cpp
index 851d4a9..65c976c 100644
--- a/tests/src/test_numeric_threshold.cpp
+++ b/tests/src/test_numeric_threshold.cpp
@@ -23,7 +23,8 @@
     std::shared_ptr<NumericThreshold> sut;
 
     void makeThreshold(Milliseconds dwellTime, numeric::Direction direction,
-                       double thresholdValue)
+                       double thresholdValue,
+                       numeric::Type type = numeric::Type::lowerWarning)
     {
         std::vector<std::unique_ptr<interfaces::TriggerAction>> actions;
         actions.push_back(std::move(actionMockPtr));
@@ -32,13 +33,19 @@
             DbusEnvironment::getIoc(),
             utils::convContainer<std::shared_ptr<interfaces::Sensor>>(
                 sensorMocks),
-            sensorNames, std::move(actions), dwellTime, direction,
-            thresholdValue);
+            std::move(actions), dwellTime, direction, thresholdValue, type);
     }
 
     void SetUp() override
     {
-        makeThreshold(0ms, numeric::Direction::increasing, 90.0);
+        for (size_t idx = 0; idx < sensorMocks.size(); idx++)
+        {
+            ON_CALL(*sensorMocks.at(idx), getName())
+                .WillByDefault(Return(sensorNames[idx]));
+        }
+
+        makeThreshold(0ms, numeric::Direction::increasing, 90.0,
+                      numeric::Type::upperCritical);
     }
 };
 
@@ -60,6 +67,13 @@
     EXPECT_CALL(actionMock, commit(_, _, _)).Times(0);
 }
 
+TEST_F(TestNumericThreshold, getLabeledParamsReturnsCorrectly)
+{
+    LabeledThresholdParam expected = numeric::LabeledThresholdParam(
+        numeric::Type::upperCritical, 0, numeric::Direction::increasing, 90.0);
+    EXPECT_EQ(sut->getThresholdParam(), expected);
+}
+
 struct NumericParams
 {
     NumericParams& Direction(numeric::Direction val)
@@ -114,6 +128,12 @@
   public:
     void SetUp() override
     {
+        for (size_t idx = 0; idx < sensorMocks.size(); idx++)
+        {
+            ON_CALL(*sensorMocks.at(idx), getName())
+                .WillByDefault(Return(sensorNames[idx]));
+        }
+
         makeThreshold(0ms, GetParam().direction, 90.0);
     }
 };
@@ -205,6 +225,12 @@
   public:
     void SetUp() override
     {
+        for (size_t idx = 0; idx < sensorMocks.size(); idx++)
+        {
+            ON_CALL(*sensorMocks.at(idx), getName())
+                .WillByDefault(Return(sensorNames[idx]));
+        }
+
         makeThreshold(2ms, GetParam().direction, 90.0);
     }
 
@@ -303,6 +329,12 @@
   public:
     void SetUp() override
     {
+        for (size_t idx = 0; idx < sensorMocks.size(); idx++)
+        {
+            ON_CALL(*sensorMocks.at(idx), getName())
+                .WillByDefault(Return(sensorNames[idx]));
+        }
+
         makeThreshold(2ms, GetParam().direction, 90.0);
     }