Activation: initially support psu update

Initial support for PSU update by starting a systemd unit with PSU
inventory path and image dir as arguments.

Add an example psu-update@.service that shows how the arguments are
passed to systemd unit and expanded to command line arguments.

Tested: Upload a dummy tarball, create a dummy service that only prints
        the arguments, and verify the service is invoked correctly when
        the RequestedActivation is set to Active.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I7e122f1cce234caf4951d3e3daad5bee406b507b
diff --git a/test/test_activation.cpp b/test/test_activation.cpp
new file mode 100644
index 0000000..0ea3640
--- /dev/null
+++ b/test/test_activation.cpp
@@ -0,0 +1,53 @@
+#include "activation.hpp"
+
+#include <sdbusplus/test/sdbus_mock.hpp>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using namespace phosphor::software::updater;
+
+class TestActivation : public ::testing::Test
+{
+  public:
+    using ActivationStatus = sdbusplus::xyz::openbmc_project::Software::server::
+        Activation::Activations;
+    TestActivation()
+    {
+    }
+    ~TestActivation()
+    {
+    }
+    static constexpr auto dBusPath = SOFTWARE_OBJPATH;
+    sdbusplus::SdBusMock sdbusMock;
+    sdbusplus::bus::bus mockedBus = sdbusplus::get_mocked_new(&sdbusMock);
+    std::unique_ptr<Activation> activation;
+    std::string versionId = "abcdefgh";
+    std::string extVersion = "Some Ext Version";
+    ActivationStatus status = ActivationStatus::Active;
+    AssociationList associations;
+};
+
+TEST_F(TestActivation, ctordtor)
+{
+    activation = std::make_unique<Activation>(mockedBus, dBusPath, versionId,
+                                              extVersion, status, associations);
+}
+
+namespace phosphor::software::updater::internal
+{
+extern std::string getUpdateService(const std::string& psuInventoryPath,
+                                    const std::string& versionId);
+}
+
+TEST_F(TestActivation, getUpdateService)
+{
+    std::string psuInventoryPath = "/com/example/inventory/powersupply1";
+    std::string versionId = "12345678";
+    std::string toCompare = "psu-update@-com-example-inventory-"
+                            "powersupply1\\x20-tmp-images-12345678.service";
+
+    auto service = phosphor::software::updater::internal::getUpdateService(
+        psuInventoryPath, versionId);
+    EXPECT_EQ(toCompare, service);
+}