Refactor mapper application to enable unit tests
Change-Id: I58cac8879f93ce49bfb654a1bf559d7f77b5b486
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/phosphor-ldap-mapper/ldap_mapper_entry.cpp b/phosphor-ldap-mapper/ldap_mapper_entry.cpp
index 95f381d..8410942 100644
--- a/phosphor-ldap-mapper/ldap_mapper_entry.cpp
+++ b/phosphor-ldap-mapper/ldap_mapper_entry.cpp
@@ -20,12 +20,13 @@
using Argument = xyz::openbmc_project::Common::InvalidArgument;
LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus &bus, const char *path,
+ const char *filePath,
const std::string &groupName,
const std::string &privilege,
LDAPMapperMgr &parent) :
Ifaces(bus, path, true),
id(std::stol(std::experimental::filesystem::path(path).filename())),
- manager(parent)
+ manager(parent), persistPath(filePath)
{
Ifaces::privilege(privilege, true);
Ifaces::groupName(groupName, true);
@@ -33,10 +34,10 @@
}
LDAPMapperEntry::LDAPMapperEntry(sdbusplus::bus::bus &bus, const char *path,
- LDAPMapperMgr &parent) :
+ const char *filePath, LDAPMapperMgr &parent) :
Ifaces(bus, path, true),
id(std::stol(std::experimental::filesystem::path(path).filename())),
- manager(parent)
+ manager(parent), persistPath(filePath)
{
}
@@ -54,7 +55,7 @@
manager.checkPrivilegeMapper(value);
auto val = Ifaces::groupName(value);
- serialize(*this, id);
+ serialize(*this, id, persistPath);
return val;
}
@@ -67,7 +68,7 @@
manager.checkPrivilegeLevel(value);
auto val = Ifaces::privilege(value);
- serialize(*this, id);
+ serialize(*this, id, persistPath);
return val;
}