Rename getPSUInventoryPath to getPSUInventoryPaths
Rename the utils method/function getPSUInventoryPath() to
getPSUInventoryPaths(). The method/function returns multiple paths in a
vector, so the name should be plural. This will make the return type
more clear. Currently the name implies only one path will be returned.
Tested:
* Verified all automated tests build and run successfully
* Verified getPSUInventoryPaths() returns correct data
Change-Id: I7e215c37e3ce1eb27313bc51348c7f7335c8f67a
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/test/mocked_utils.hpp b/test/mocked_utils.hpp
index 873c73b..7c293cf 100644
--- a/test/mocked_utils.hpp
+++ b/test/mocked_utils.hpp
@@ -16,7 +16,7 @@
~MockedUtils() override = default;
- MOCK_CONST_METHOD1(getPSUInventoryPath,
+ MOCK_CONST_METHOD1(getPSUInventoryPaths,
std::vector<std::string>(sdbusplus::bus_t& bus));
MOCK_CONST_METHOD3(getService,
diff --git a/test/test_activation.cpp b/test/test_activation.cpp
index 4beffbc..273f132 100644
--- a/test/test_activation.cpp
+++ b/test/test_activation.cpp
@@ -115,7 +115,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({}))); // No PSU inventory
activation->requestedActivation(RequestedStatus::Active);
@@ -136,7 +136,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
activation->requestedActivation(RequestedStatus::Active);
@@ -165,7 +165,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(
std::vector<std::string>({psu0, psu1, psu2, psu3}))); // 4 PSUs
activation->requestedActivation(RequestedStatus::Active);
@@ -217,7 +217,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(
std::vector<std::string>({psu0, psu1, psu2, psu3}))); // 4 PSUs
activation->requestedActivation(RequestedStatus::Active);
@@ -249,7 +249,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
ON_CALL(sdbusMock, sd_bus_call(_, _, _, _, nullptr))
@@ -266,7 +266,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(std::vector<std::string>({psu0})));
activation->requestedActivation(RequestedStatus::Active);
@@ -280,7 +280,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(std::vector<std::string>({psu0})));
activation->requestedActivation(RequestedStatus::Active);
@@ -297,7 +297,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
activation->requestedActivation(RequestedStatus::Active);
@@ -325,7 +325,7 @@
activation = std::make_unique<Activation>(
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(
std::vector<std::string>({psu0, psu1, psu2, psu3}))); // 4 PSUs
activation->requestedActivation(RequestedStatus::Active);
@@ -366,7 +366,7 @@
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
@@ -389,7 +389,7 @@
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
@@ -410,7 +410,7 @@
mockedBus, dBusPath, versionId, extVersion, status, associations,
filePath, &mockedAssociationInterface, &mockedActivationListener);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(
Return(std::vector<std::string>({psu0}))); // One PSU inventory
diff --git a/test/test_item_updater.cpp b/test/test_item_updater.cpp
index ad01f42..7523bfc 100644
--- a/test/test_item_updater.cpp
+++ b/test/test_item_updater.cpp
@@ -83,7 +83,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -107,7 +107,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -139,7 +139,7 @@
auto objPath0 = getObjPath(version0);
auto objPath1 = getObjPath(version1);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psu0, psu1})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psu0), _))
.WillOnce(Return(service));
@@ -189,7 +189,7 @@
auto objPath0 = getObjPath(version0);
auto objPath1 = getObjPath(version1);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psu0, psu1})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psu0), _))
.WillOnce(Return(service));
@@ -241,7 +241,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -279,7 +279,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -313,7 +313,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -375,7 +375,7 @@
auto objPath0 = getObjPath(version0);
auto objPath1 = getObjPath(version1);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psu0, psu1})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psu0), _))
.WillOnce(Return(service));
@@ -458,7 +458,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -492,7 +492,7 @@
constexpr auto service = "com.example.Software.Psu";
constexpr auto version = "version0";
std::string objPath = getObjPath(version);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service));
@@ -538,7 +538,7 @@
auto objPath0 = getObjPath(version0);
auto objPath1 = getObjPath(version1);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psu0, psu1})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psu0), _))
.WillOnce(Return(service));
@@ -606,7 +606,7 @@
auto objPath0 = getObjPath(version0);
auto objPath1 = getObjPath(version1);
- EXPECT_CALL(mockedUtils, getPSUInventoryPath(_))
+ EXPECT_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillOnce(Return(std::vector<std::string>({psu0, psu1})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psu0), _))
.WillOnce(Return(service));
@@ -665,7 +665,7 @@
std::string versionId =
version; // In testing versionId is the same as version
std::string objPath = getObjPath(version);
- ON_CALL(mockedUtils, getPSUInventoryPath(_))
+ ON_CALL(mockedUtils, getPSUInventoryPaths(_))
.WillByDefault(Return(std::vector<std::string>({psuPath})));
EXPECT_CALL(mockedUtils, getService(_, StrEq(psuPath), _))
.WillOnce(Return(service))
diff --git a/test/test_utils.cpp b/test/test_utils.cpp
index 114b93a..d12e1f3 100644
--- a/test/test_utils.cpp
+++ b/test/test_utils.cpp
@@ -57,7 +57,7 @@
EXPECT_CALL(sdbusMock, sd_bus_message_exit_container(IsNull()))
.WillOnce(Return(0)); /* end of std::vector */
- auto ret = utils::getPSUInventoryPath(bus);
+ auto ret = utils::getPSUInventoryPaths(bus);
EXPECT_EQ(2U, ret.size());
EXPECT_EQ(path0, ret[0]);
EXPECT_EQ(path1, ret[1]);