test: PID Zone: use PDI constants
Use the PDI constants instead of re-defining them here.
Tested: Unit Tests Pass
Change-Id: I0f6c246675c2bc41698fc8721adc59864fadfd3f
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index fee388c..c3daf47 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -14,6 +14,10 @@
#include <systemd/sd-bus.h>
#include <sdbusplus/test/sdbus_mock.hpp>
+#include <xyz/openbmc_project/Control/Mode/common.hpp>
+#include <xyz/openbmc_project/Debug/Pid/ThermalPower/common.hpp>
+#include <xyz/openbmc_project/Debug/Pid/Zone/common.hpp>
+#include <xyz/openbmc_project/Object/Enable/common.hpp>
#include <chrono>
#include <cstdint>
@@ -39,11 +43,11 @@
using ::testing::Return;
using ::testing::StrEq;
-static std::string modeInterface = "xyz.openbmc_project.Control.Mode";
-static std::string debugZoneInterface = "xyz.openbmc_project.Debug.Pid.Zone";
-static std::string enableInterface = "xyz.openbmc_project.Object.Enable";
-static std::string debugThermalPowerInterface =
- "xyz.openbmc_project.Debug.Pid.ThermalPower";
+using ControlMode = sdbusplus::common::xyz::openbmc_project::control::Mode;
+using DebugPidZone = sdbusplus::common::xyz::openbmc_project::debug::pid::Zone;
+using DebugThermalPower =
+ sdbusplus::common::xyz::openbmc_project::debug::pid::ThermalPower;
+using ObjectEnable = sdbusplus::common::xyz::openbmc_project::object::Enable;
namespace
{
@@ -76,9 +80,9 @@
double d;
std::vector<std::string> properties;
- SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface, properties,
- &d);
- SetupDbusObject(&sdbus_mock_mode, defer, objPath, debugZoneInterface,
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath, ControlMode::interface,
+ properties, &d);
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath, DebugPidZone::interface,
properties, &d);
std::string sensorname = "temp1";
@@ -88,7 +92,7 @@
double de;
std::vector<std::string> propertiesenable;
SetupDbusObject(&sdbus_mock_enable, defer, pidsensorpath.c_str(),
- enableInterface, propertiesenable, &de);
+ ObjectEnable::interface, propertiesenable, &de);
DbusPidZone p(zone, minThermalOutput, failSafePercent, cycleTime, m,
bus_mock_mode, objPath, defer, accSetPoint);
@@ -116,13 +120,13 @@
mgr = SensorManager(bus_mock_passive, bus_mock_host);
- SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface,
- properties, &property_index);
- SetupDbusObject(&sdbus_mock_mode, defer, objPath, debugZoneInterface,
- properties, &property_index);
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath,
+ ControlMode::interface, properties, &property_index);
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath,
+ DebugPidZone::interface, properties, &property_index);
SetupDbusObject(&sdbus_mock_enable, defer, pidsensorpath.c_str(),
- enableInterface, propertiesenable,
+ ObjectEnable::interface, propertiesenable,
&propertyenable_index);
zone = std::make_unique<DbusPidZone>(
@@ -183,7 +187,7 @@
EXPECT_CALL(sdbus_mock_mode, sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(pidsensorpath.c_str()),
- StrEq(enableInterface), NotNull()))
+ StrEq(ObjectEnable::interface), NotNull()))
.Times(::testing::AnyNumber())
.WillOnce(Invoke(
[&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
@@ -240,7 +244,7 @@
EXPECT_CALL(sdbus_mock_mode, sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(pidsensorpath.c_str()),
- StrEq(enableInterface), NotNull()))
+ StrEq(ObjectEnable::interface), NotNull()))
.Times(::testing::AnyNumber())
.WillOnce(Invoke(
[&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
@@ -284,7 +288,7 @@
EXPECT_CALL(sdbus_mock_mode, sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(pidsensorpath.c_str()),
- StrEq(enableInterface), NotNull()))
+ StrEq(ObjectEnable::interface), NotNull()))
.Times(::testing::AnyNumber())
.WillOnce(Invoke(
[&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
@@ -840,9 +844,9 @@
// Verifies that someone doesn't remove the internal call to the dbus
// object from which we're inheriting.
- EXPECT_CALL(sdbus_mock_mode,
- sd_bus_emit_properties_changed_strv(
- IsNull(), StrEq(objPath), StrEq(modeInterface), NotNull()))
+ EXPECT_CALL(sdbus_mock_mode, sd_bus_emit_properties_changed_strv(
+ IsNull(), StrEq(objPath),
+ StrEq(ControlMode::interface), NotNull()))
.WillOnce(Invoke(
[&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
[[maybe_unused]] const char* interface, const char** names) {