Migrate update_service_test.cpp from Gerrit to Google3.

Google-Bug-Id:548089848
PiperOrigin-RevId: 968120825
Change-Id: Ic2e34411300cf965f30a5543404c214b66a54767
diff --git a/copy.bara.sky b/copy.bara.sky
index 43944cf..0300de8 100644
--- a/copy.bara.sky
+++ b/copy.bara.sky
@@ -298,6 +298,7 @@
     ("test/redfish_core/lib/system_multi_host_test.cc", "test/redfish-core/lib/system_multi_host_test.cpp"),
     ("test/redfish_core/lib/system_test.cc", "test/redfish-core/lib/system_test.cpp"),
     ("test/redfish_core/lib/system_utils_test.cc", "test/redfish-core/lib/system_utils_test.cpp"),
+    ("test/redfish_core/lib/update_service_test.cc", "test/redfish-core/lib/update_service_test.cpp"),
     # go/keep-sorted end
 ]
 
diff --git a/test/redfish-core/lib/update_service_test.cpp b/test/redfish-core/lib/update_service_test.cpp
index 206b634..b6f1916 100644
--- a/test/redfish-core/lib/update_service_test.cpp
+++ b/test/redfish-core/lib/update_service_test.cpp
@@ -1,111 +1,115 @@
 #include "update_service.hpp"
 
+#include <string>
 #include <unordered_set>
-#include <string_view>
-
-#include "snapshot_fixture.hpp"
 
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
+#include "snapshot_fixture.hpp"
+#include <nlohmann/json.hpp>
 
-namespace redfish
-{
+namespace redfish {
+namespace {
 
 using ::testing::Contains;
 using ::testing::NotNull;
 
-
 TEST_F(SnapshotFixture_Platform11_Config4,
-     UpdateServiceCollectionReturnsExpectedResponse)
-{
-  handleSoftwareInventoryCollectionGet(
-      app_, CreateRequest(), share_async_resp_);
+       UpdateServiceCollectionReturnsExpectedResponse) {
+  handleSoftwareInventoryCollectionGet(app_, CreateRequest(),
+                                       share_async_resp_);
 
   RunIoUntilDone();
 
   nlohmann::json& json = share_async_resp_->res.jsonValue;
   EXPECT_EQ(json["@odata.id"], "/redfish/v1/UpdateService/FirmwareInventory");
-  EXPECT_EQ(json["@odata.type"], "#SoftwareInventoryCollection.SoftwareInventoryCollection");
+  EXPECT_EQ(json["@odata.type"],
+            "#SoftwareInventoryCollection.SoftwareInventoryCollection");
   EXPECT_EQ(json["Name"], "Software Inventory Collection");
   EXPECT_EQ(json["Members"].size(), json["Members@odata.count"]);
 
-  const std::unordered_set<std::string> firmware_members {{
-    "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
-    "/redfish/v1/UpdateService/FirmwareInventory/cpld_1",
-    "/redfish/v1/UpdateService/FirmwareInventory/cpld_2",
-    "/redfish/v1/UpdateService/FirmwareInventory/cpld_3",
-    "/redfish/v1/UpdateService/FirmwareInventory/cpld_4",
-    "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_1",
-    "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_2",
-    "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_3",
-    "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_4",
-    "/redfish/v1/UpdateService/FirmwareInventory/morristown_1",
-    "/redfish/v1/UpdateService/FirmwareInventory/morristown_2",
-    "/redfish/v1/UpdateService/FirmwareInventory/morristown_3",
-    "/redfish/v1/UpdateService/FirmwareInventory/morristown_4",
-    "/redfish/v1/UpdateService/FirmwareInventory/config1_temporary_efuse_enable_1",
-    "/redfish/v1/UpdateService/FirmwareInventory/config1_temporary_efuse_enable_2",
-    "/redfish/v1/UpdateService/FirmwareInventory/config1_temporary_efuse_enable_3",
-    "/redfish/v1/UpdateService/FirmwareInventory/config1_temporary_efuse_enable_4",
-    "/redfish/v1/UpdateService/FirmwareInventory/f203a9c8",
-    "/redfish/v1/UpdateService/FirmwareInventory/hoth_ro",
-    "/redfish/v1/UpdateService/FirmwareInventory/hoth_rw"
+  const std::unordered_set<std::string> firmware_members{{
+      "/redfish/v1/UpdateService/FirmwareInventory/bios_active",
+      "/redfish/v1/UpdateService/FirmwareInventory/cpld_1",
+      "/redfish/v1/UpdateService/FirmwareInventory/cpld_2",
+      "/redfish/v1/UpdateService/FirmwareInventory/cpld_3",
+      "/redfish/v1/UpdateService/FirmwareInventory/cpld_4",
+      "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_1",
+      "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_2",
+      "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_3",
+      "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_4",
+      "/redfish/v1/UpdateService/FirmwareInventory/morristown_1",
+      "/redfish/v1/UpdateService/FirmwareInventory/morristown_2",
+      "/redfish/v1/UpdateService/FirmwareInventory/morristown_3",
+      "/redfish/v1/UpdateService/FirmwareInventory/morristown_4",
+      "/redfish/v1/UpdateService/FirmwareInventory/"
+      "config1_temporary_efuse_enable_1",
+      "/redfish/v1/UpdateService/FirmwareInventory/"
+      "config1_temporary_efuse_enable_2",
+      "/redfish/v1/UpdateService/FirmwareInventory/"
+      "config1_temporary_efuse_enable_3",
+      "/redfish/v1/UpdateService/FirmwareInventory/"
+      "config1_temporary_efuse_enable_4",
+      "/redfish/v1/UpdateService/FirmwareInventory/f203a9c8",
+      "/redfish/v1/UpdateService/FirmwareInventory/hoth_ro",
+      "/redfish/v1/UpdateService/FirmwareInventory/hoth_rw",
   }};
 
   EXPECT_EQ(json["Members@odata.count"], firmware_members.size());
-  for (const auto& member : json["Members"])
-  {
-      ASSERT_TRUE(member.contains("@odata.id"));
-      const std::string* firmware = member["@odata.id"].get_ptr<const std::string*>();
-      ASSERT_THAT(firmware, NotNull());
-      EXPECT_THAT(firmware_members, Contains(*firmware));
+  for (const auto& member : json["Members"]) {
+    ASSERT_TRUE(member.contains("@odata.id"));
+    const std::string* firmware =
+        member["@odata.id"].get_ptr<const std::string*>();
+    ASSERT_THAT(firmware, NotNull());
+    EXPECT_THAT(firmware_members, Contains(*firmware));
   }
 }
 
 TEST_F(SnapshotFixture_Platform11_Config4,
-     CpldUpdateServiceReturnsExpectedResponse)
-{
-  handleSoftwareInventoryGet(app_,
-      CreateRequest(), share_async_resp_,
-      "cpld_1");
+       CpldUpdateServiceReturnsExpectedResponse) {
+  handleSoftwareInventoryGet(app_, CreateRequest(), share_async_resp_,
+                             "cpld_1");
 
   RunIoUntilDone();
 
   nlohmann::json& json = share_async_resp_->res.jsonValue;
-  EXPECT_EQ(json["@odata.id"], "/redfish/v1/UpdateService/FirmwareInventory/cpld_1");
+  EXPECT_EQ(json["@odata.id"],
+            "/redfish/v1/UpdateService/FirmwareInventory/cpld_1");
   EXPECT_EQ(json["@odata.type"], "#SoftwareInventory.v1_3_0.SoftwareInventory");
   EXPECT_EQ(json["Description"], "Other image");
   EXPECT_EQ(json["Id"], "cpld_1");
   EXPECT_EQ(json["Name"], "Software Inventory");
   EXPECT_EQ(json["RelatedItem"].size(), json["RelatedItem@odata.count"]);
-  EXPECT_EQ(json["RelatedItem"][0]["@odata.id"], "/redfish/v1/Systems/system/Storage/config1_storage_1/Controllers/cpld");
+  EXPECT_EQ(
+      json["RelatedItem"][0]["@odata.id"],
+      "/redfish/v1/Systems/system/Storage/config1_storage_1/Controllers/cpld");
   EXPECT_EQ(json["Status"]["HealthRollup"], "OK");
   EXPECT_FALSE(json["Updateable"]);
   EXPECT_EQ(json["Version"], "Version");
 }
 
 TEST_F(SnapshotFixture_Platform11_Config4,
-     FruEepromUpdateServiceReturnsExpectedResponse)
-{
-  handleSoftwareInventoryGet(app_,
-      CreateRequest(), share_async_resp_,
-      "fru_eeprom_1");
+       FruEepromUpdateServiceReturnsExpectedResponse) {
+  handleSoftwareInventoryGet(app_, CreateRequest(), share_async_resp_,
+                             "fru_eeprom_1");
 
   RunIoUntilDone();
 
   nlohmann::json& json = share_async_resp_->res.jsonValue;
-  EXPECT_EQ(json["@odata.id"], "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_1");
+  EXPECT_EQ(json["@odata.id"],
+            "/redfish/v1/UpdateService/FirmwareInventory/fru_eeprom_1");
   EXPECT_EQ(json["@odata.type"], "#SoftwareInventory.v1_3_0.SoftwareInventory");
   EXPECT_EQ(json["Description"], "Other image");
   EXPECT_EQ(json["Id"], "fru_eeprom_1");
   EXPECT_EQ(json["Name"], "Software Inventory");
   EXPECT_EQ(json["RelatedItem"].size(), json["RelatedItem@odata.count"]);
-  EXPECT_EQ(json["RelatedItem"][0]["@odata.id"], "/redfish/v1/Chassis/config1_1/Drives/config1_1");
+  EXPECT_EQ(json["RelatedItem"][0]["@odata.id"],
+            "/redfish/v1/Chassis/config1_1/Drives/config1_1");
   EXPECT_EQ(json["Status"]["HealthRollup"], "OK");
   EXPECT_FALSE(json["Updateable"]);
   EXPECT_EQ(json["Version"], "Version");
   EXPECT_TRUE(json["WriteProtected"]);
 }
 
-}
-
+}  // namespace
+}  // namespace redfish