utils: Retrieval of managed objects of DBUS
This commit implements functionality to retrieve the managed object of a
specific DBUS service on a particular path. Additionally implements a
function template for inventory objects which efficiently enables
retrieval of managed object for Inventory Manager.
Tested: Added unit test cases for checking the return value.
Change-Id: Ide652f843db1623bdacebf3e269e03895bbb7f1a
Signed-off-by: Riya Dixit <riyadixitagra@gmail.com>
diff --git a/common/test/mocked_utils.hpp b/common/test/mocked_utils.hpp
index 71bc6e7..e42677c 100644
--- a/common/test/mocked_utils.hpp
+++ b/common/test/mocked_utils.hpp
@@ -22,6 +22,35 @@
} // namespace utils
} // namespace pldm
+class GetManagedEmptyObject
+{
+ public:
+ static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
+ const char* /*path*/)
+ {
+ return pldm::utils::ObjectValueTree{};
+ }
+};
+
+class GetManagedObject
+{
+ public:
+ static pldm::utils::ObjectValueTree getManagedObj(const char* /*service*/,
+ const char* /*path*/)
+ {
+ return pldm::utils::ObjectValueTree{
+ {sdbusplus::message::object_path("/foo/bar"),
+ {{"foo.bar",
+ {{"Functional", true},
+ {"Enabled", true},
+ {"PrettyName", "System"},
+ {"Present", true},
+ {"SerialNumber", "abc123z"},
+ {"Model", "1234 - 00Z"},
+ {"SubModel", "S0"}}}}}};
+ }
+};
+
class MockdBusHandler : public pldm::utils::DBusHandler
{
public: