SettingsRegistryOriginTrackerTests.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/IO/SystemFile.h>
  9. #include <AzCore/UnitTest/TestTypes.h>
  10. #include <AzCore/JSON/document.h>
  11. #include <AzCore/JSON/writer.h>
  12. #include <AzCore/Name/NameDictionary.h>
  13. #include <AzCore/Settings/SettingsRegistry.h>
  14. #include <AzCore/Settings/SettingsRegistryImpl.h>
  15. #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
  16. #include <AzCore/Settings/SettingsRegistryOriginTracker.h>
  17. #include <AzCore/std/containers/deque.h>
  18. #include <AzCore/std/containers/vector.h>
  19. #include <AzCore/std/smart_ptr/unique_ptr.h>
  20. #include <AzCore/std/string/string.h>
  21. #include <AzCore/std/string/string_view.h>
  22. #include <AZTestShared/Utils/Utils.h>
  23. namespace AZ
  24. {
  25. // Pretty printers for the SettingsRegistryOrigin struct
  26. void PrintTo(const AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin& origin, ::std::ostream* os)
  27. {
  28. *os << "file path: " << AZ::IO::Path(origin.m_originFilePath.Native(), AZ::IO::PosixPathSeparator).MakePreferred().c_str() << '\n';
  29. *os << "key path: " << origin.m_settingsKey.c_str() << '\n';
  30. *os << "value when origin set: " << (origin.m_settingsValue.has_value() ? origin.m_settingsValue->c_str() : "<removed>") << '\n';
  31. }
  32. } // namespace AZ
  33. namespace SettingsRegistryOriginTrackerTests
  34. {
  35. const AZStd::string OBJECT_VALUE = "<object>";
  36. const AZStd::string ARRAY_VALUE = "<array>";
  37. class SettingsRegistryOriginTrackerFixture : public UnitTest::LeakDetectionFixture
  38. {
  39. public:
  40. SettingsRegistryOriginTrackerFixture()
  41. {
  42. if (!AZ::NameDictionary::IsReady())
  43. {
  44. AZ::NameDictionary::Create();
  45. m_createdNameDictionary = true;
  46. }
  47. }
  48. ~SettingsRegistryOriginTrackerFixture()
  49. {
  50. if (m_createdNameDictionary)
  51. {
  52. AZ::NameDictionary::Destroy();
  53. m_createdNameDictionary = false;
  54. }
  55. }
  56. void SetUp() override
  57. {
  58. m_registry = AZStd::make_unique<AZ::SettingsRegistryImpl>();
  59. m_originTracker = AZStd::make_unique<AZ::SettingsRegistryOriginTracker>(*m_registry);
  60. }
  61. void TearDown() override
  62. {
  63. m_originTracker.reset();
  64. m_registry.reset();
  65. }
  66. void CheckOriginsAtPath(
  67. const AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack& expected, AZStd::string_view path = "")
  68. {
  69. AZStd::vector<AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin> originArray;
  70. auto GetOrigins = [&originArray](AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin origin)
  71. {
  72. originArray.push_back(origin);
  73. return true;
  74. };
  75. m_originTracker->VisitOrigins(path, GetOrigins);
  76. for (const auto& settingsRegistryOrigin : expected)
  77. {
  78. EXPECT_THAT(originArray, ::testing::Contains(settingsRegistryOrigin));
  79. }
  80. EXPECT_EQ(expected.size(), originArray.size());
  81. }
  82. protected:
  83. AZStd::unique_ptr<AZ::SettingsRegistryImpl> m_registry;
  84. AZStd::unique_ptr<AZ::SettingsRegistryOriginTracker> m_originTracker;
  85. AZ::Test::ScopedAutoTempDirectory m_testFolder;
  86. bool m_createdNameDictionary = false;
  87. };
  88. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFile_TracksOrigin_Successful)
  89. {
  90. constexpr AZ::IO::PathView filePath1 = "folder1/file1.json";
  91. constexpr AZ::IO::PathView filePath2 = "folder2/file2.json";
  92. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  93. {
  94. "O3DE": {
  95. "Settings": {
  96. "ArrayValue": [
  97. 5,
  98. 7,
  99. 40000000,
  100. -89396
  101. ],
  102. "ObjectValue": {
  103. "StringKey1": "Hello",
  104. "BoolKey1": true
  105. }
  106. }
  107. }
  108. }
  109. )"));
  110. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  111. {
  112. "O3DE": {
  113. "Settings": {
  114. "ArrayValue": [
  115. 27,
  116. 39,
  117. 42
  118. ],
  119. "ObjectValue": {
  120. "IntKey2": 9001,
  121. },
  122. "DoubleValue": 4.0
  123. }
  124. }
  125. }
  126. )"));
  127. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  128. m_registry->MergeSettingsFile(
  129. (tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  130. m_registry->MergeSettingsFile(
  131. (tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  132. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedObjectValueOriginStack = {
  133. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue", OBJECT_VALUE },
  134. { tempRootFolder / filePath2, "/O3DE/Settings/ObjectValue", OBJECT_VALUE },
  135. { tempRootFolder / filePath2, "/O3DE/Settings/ObjectValue/IntKey2", "9001" },
  136. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue/BoolKey1", "true" },
  137. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue/StringKey1", "\"Hello\"" },
  138. };
  139. CheckOriginsAtPath(expectedObjectValueOriginStack, "/O3DE/Settings/ObjectValue");
  140. }
  141. TEST_F(SettingsRegistryOriginTrackerFixture, MergeArraySettings_TracksArrayOriginWithPatch_Successful)
  142. {
  143. constexpr AZ::IO::PathView filePath1 = "folder1/file1.setregpatch";
  144. constexpr AZ::IO::PathView filePath2 = "folder2/file2.setregpatch";
  145. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  146. [
  147. {"op": "add", "path": "/O3DE", "value": {}},
  148. {"op": "add", "path" : "/O3DE/ArrayValue", "value": []},
  149. {"op": "add", "path" : "/O3DE/ArrayValue/0", "value": 5},
  150. {"op": "add", "path" : "/O3DE/ArrayValue/1", "value": 7},
  151. {"op": "add", "path" : "/O3DE/ArrayValue/2", "value": 40000000},
  152. {"op": "add", "path" : "/O3DE/ArrayValue/3", "value": -89396}
  153. ]
  154. )"));
  155. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  156. [
  157. {"op": "replace", "path" : "/O3DE/ArrayValue/0", "value" : 27},
  158. {"op": "replace", "path" : "/O3DE/ArrayValue/1", "value" : 39},
  159. {"op": "replace", "path" : "/O3DE/ArrayValue/2", "value" : 42}
  160. ]
  161. )"));
  162. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  163. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonPatch);
  164. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonPatch);
  165. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedArrayValueOriginStack = {
  166. { tempRootFolder / filePath1, "/O3DE/ArrayValue", ARRAY_VALUE },
  167. { tempRootFolder / filePath1, "/O3DE/ArrayValue/3", "-89396" },
  168. { tempRootFolder / filePath1, "/O3DE/ArrayValue/2", "40000000" },
  169. { tempRootFolder / filePath2, "/O3DE/ArrayValue/2", "42" },
  170. { tempRootFolder / filePath1, "/O3DE/ArrayValue/1", "7" },
  171. { tempRootFolder / filePath2, "/O3DE/ArrayValue/1", "39" },
  172. { tempRootFolder / filePath1, "/O3DE/ArrayValue/0", "5" },
  173. { tempRootFolder / filePath2, "/O3DE/ArrayValue/0", "27" },
  174. };
  175. CheckOriginsAtPath(expectedArrayValueOriginStack, "/O3DE/ArrayValue");
  176. }
  177. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFile_RemoveDuplicateOrigin_Successful)
  178. {
  179. constexpr AZ::IO::PathView filePath1 = "folder1/file1.json";
  180. constexpr AZ::IO::PathView filePath2 = "folder2/file2.json";
  181. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  182. {
  183. "O3DE": {
  184. "Settings": {
  185. "ObjectValue": {
  186. "StringKey1": "Hello",
  187. "BoolKey1": true
  188. }
  189. }
  190. }
  191. }
  192. )"));
  193. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  194. {
  195. "O3DE": {
  196. "Settings": {
  197. "ObjectValue": {
  198. "IntKey2": 9001
  199. },
  200. }
  201. }
  202. }
  203. )"));
  204. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  205. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  206. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  207. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  208. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedObjectValueOriginStack = {
  209. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue", OBJECT_VALUE },
  210. { tempRootFolder / filePath2, "/O3DE/Settings/ObjectValue", OBJECT_VALUE },
  211. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue/BoolKey1", "true" },
  212. { tempRootFolder / filePath1, "/O3DE/Settings/ObjectValue/StringKey1", "\"Hello\"" },
  213. { tempRootFolder / filePath2, "/O3DE/Settings/ObjectValue/IntKey2", "9001" }
  214. };
  215. CheckOriginsAtPath(expectedObjectValueOriginStack, "/O3DE/Settings/ObjectValue");
  216. }
  217. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFileAndCode_TracksOrigin_Successful)
  218. {
  219. constexpr AZ::IO::PathView filePath1 = "folder1/file1.setreg";
  220. constexpr AZ::IO::PathView filePath2 = "folder2/file2.setreg";
  221. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  222. {
  223. "O3DE": {
  224. "ObjectValue": {
  225. "StringKey1": "Hello",
  226. "BoolKey1": true
  227. }
  228. }
  229. }
  230. )"));
  231. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  232. {
  233. "O3DE": {
  234. "ObjectValue": {
  235. "StringKey1": "Hi",
  236. "IntKey2": 9001
  237. }
  238. }
  239. }
  240. )"));
  241. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  242. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  243. AZStd::string_view stringKey1Path = "/O3DE/ObjectValue/StringKey1";
  244. AZStd::string_view stringKey1NewValue = R"(Greetings)";
  245. ASSERT_TRUE(m_registry->Set(stringKey1Path, stringKey1NewValue));
  246. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch, "", nullptr);
  247. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedObjectValueOriginStack = {
  248. { tempRootFolder / filePath1, "/O3DE/ObjectValue", OBJECT_VALUE },
  249. { tempRootFolder / filePath2, "/O3DE/ObjectValue", OBJECT_VALUE },
  250. { tempRootFolder / filePath2, "/O3DE/ObjectValue/IntKey2", "9001" },
  251. { tempRootFolder / filePath1, "/O3DE/ObjectValue/BoolKey1", "true" },
  252. { tempRootFolder / filePath1, "/O3DE/ObjectValue/StringKey1", "\"Hello\"" },
  253. { "<in-memory>", "/O3DE/ObjectValue/StringKey1", "\"Greetings\"" },
  254. { tempRootFolder / filePath2, "/O3DE/ObjectValue/StringKey1", "\"Hi\"" }
  255. };
  256. CheckOriginsAtPath(expectedObjectValueOriginStack, "/O3DE/ObjectValue");
  257. }
  258. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFiles_NestedMerge_Successful)
  259. {
  260. constexpr AZ::IO::PathView filePath1 = "folder1/file1.setreg";
  261. constexpr AZ::IO::PathView filePath2 = "folder2/file2.setreg";
  262. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  263. {
  264. "O3DE": {
  265. "foo": 1,
  266. "bar": true,
  267. "baz": "yes"
  268. }
  269. }
  270. )"));
  271. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  272. {
  273. "O3DE": {
  274. "foo": 3,
  275. "bar": false,
  276. "baz": "no"
  277. }
  278. }
  279. )"));
  280. bool mergeFile = true;
  281. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  282. auto callback = [this, &tempRootFolder, &mergeFile, &filePath2](const AZ::SettingsRegistryInterface::NotifyEventArgs& notifyEventArgs)
  283. {
  284. if (notifyEventArgs.m_jsonKeyPath == "/O3DE" && mergeFile)
  285. {
  286. mergeFile = false;
  287. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  288. }
  289. };
  290. auto testNotifier = m_registry->RegisterNotifier(callback);
  291. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  292. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedO3DEOriginStack = {
  293. { tempRootFolder / filePath1, "/O3DE", OBJECT_VALUE },
  294. { tempRootFolder / filePath2, "/O3DE/foo", "3" },
  295. { tempRootFolder / filePath1, "/O3DE/foo", "1" },
  296. { tempRootFolder / filePath1, "/O3DE/bar", "true" },
  297. { tempRootFolder / filePath2, "/O3DE/bar", "false" },
  298. { tempRootFolder / filePath1, "/O3DE/baz", R"("yes")" },
  299. { tempRootFolder / filePath2, "/O3DE/baz", R"("no")" }
  300. };
  301. AZStd::vector<AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin> originArray;
  302. auto GetOrigins = [&originArray](AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin origin)
  303. {
  304. originArray.push_back(origin);
  305. return true;
  306. };
  307. m_originTracker->VisitOrigins("/O3DE", GetOrigins);
  308. for (const auto& settingsRegistryOrigin : expectedO3DEOriginStack)
  309. {
  310. EXPECT_THAT(originArray, ::testing::Contains(settingsRegistryOrigin));
  311. }
  312. }
  313. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFiles_LargeInput_Successful)
  314. {
  315. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  316. int numIterations = 10;
  317. for (int i = 0; i < numIterations; i++)
  318. {
  319. AZ::IO::FixedMaxPath filePath = AZ::IO::FixedMaxPathString::format("file%d.setreg", i);
  320. ASSERT_TRUE(AZ::Test::CreateTestFile(
  321. m_testFolder,
  322. filePath,
  323. AZStd::string::format(
  324. R"(
  325. {
  326. "O3DE": {
  327. "persistentKey": %d,
  328. "changingKey%d": true
  329. }
  330. }
  331. )",
  332. i,
  333. i)));
  334. m_registry->MergeSettingsFile((tempRootFolder / filePath).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  335. }
  336. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedO3DEOriginStack;
  337. for (int i = 0; i < numIterations; i++)
  338. {
  339. AZ::IO::FixedMaxPath filePath = AZ::IO::FixedMaxPathString::format("file%d.setreg", i);
  340. AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin o3deOrigin{ tempRootFolder / filePath, "/O3DE", OBJECT_VALUE };
  341. AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin persistentKeyOrigin{ tempRootFolder / filePath,
  342. "/O3DE/persistentKey",
  343. AZStd::string::format("%d", i) };
  344. AZ::SettingsRegistryOriginTracker::SettingsRegistryOrigin changingKeyOrigin{ tempRootFolder / filePath,
  345. AZStd::string::format("/O3DE/changingKey%d", i),
  346. "true" };
  347. expectedO3DEOriginStack.emplace_back(o3deOrigin);
  348. expectedO3DEOriginStack.emplace_back(changingKeyOrigin);
  349. expectedO3DEOriginStack.emplace_back(persistentKeyOrigin);
  350. }
  351. CheckOriginsAtPath(expectedO3DEOriginStack, "/O3DE");
  352. }
  353. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFiles_IncludeTrackingFilter_Successful)
  354. {
  355. constexpr AZ::IO::PathView filePath1 = "folder1/file1.json";
  356. constexpr AZ::IO::PathView filePath2 = "folder2/file2.json";
  357. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  358. {
  359. "O3DE": {
  360. "ObjectValue": {
  361. "StringKey1": "Hello",
  362. "BoolKey1": true
  363. }
  364. }
  365. }
  366. )"));
  367. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  368. {
  369. "O3DE": {
  370. "ObjectValue": {
  371. "IntKey2": 9001,
  372. },
  373. }
  374. }
  375. )"));
  376. auto trackingFilterCallback = [](AZStd::string_view keyPath)
  377. {
  378. if (keyPath.contains("IntKey2"))
  379. {
  380. return false;
  381. }
  382. return true;
  383. };
  384. m_originTracker->SetTrackingFilter(trackingFilterCallback);
  385. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  386. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  387. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  388. AZ::SettingsRegistryOriginTracker::SettingsRegistryOriginStack expectedObjectValueOriginStack = {
  389. { tempRootFolder / filePath1, "/O3DE/ObjectValue", OBJECT_VALUE },
  390. { tempRootFolder / filePath2, "/O3DE/ObjectValue", OBJECT_VALUE },
  391. { tempRootFolder / filePath1, "/O3DE/ObjectValue/BoolKey1", "true" },
  392. { tempRootFolder / filePath1, "/O3DE/ObjectValue/StringKey1", "\"Hello\"" }
  393. };
  394. CheckOriginsAtPath(expectedObjectValueOriginStack, "/O3DE/ObjectValue");
  395. }
  396. TEST_F(SettingsRegistryOriginTrackerFixture, MergeSettingsFiles_FindLastOrigin_Successful)
  397. {
  398. constexpr AZ::IO::PathView filePath1 = "folder1/file1.setreg";
  399. constexpr AZ::IO::PathView filePath2 = "folder2/file2.setreg";
  400. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath1, R"(
  401. {
  402. "O3DE": {
  403. "foo": 1,
  404. "bar": true,
  405. "baz": "yes"
  406. }
  407. }
  408. )"));
  409. ASSERT_TRUE(AZ::Test::CreateTestFile(m_testFolder, filePath2, R"(
  410. {
  411. "O3DE": {
  412. "foo": 3,
  413. "baz": "no"
  414. }
  415. }
  416. )"));
  417. auto tempRootFolder = m_testFolder.GetDirectoryAsPath();
  418. m_registry->MergeSettingsFile((tempRootFolder / filePath1).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  419. m_registry->MergeSettingsFile((tempRootFolder / filePath2).Native(), AZ::SettingsRegistryInterface::Format::JsonMergePatch);
  420. AZ::IO::Path lastFooOriginPath;
  421. ASSERT_TRUE(m_originTracker->FindLastOrigin(lastFooOriginPath, "/O3DE/foo"));
  422. EXPECT_EQ(tempRootFolder / filePath2, lastFooOriginPath);
  423. AZ::IO::Path lastBarOriginPath;
  424. ASSERT_TRUE(m_originTracker->FindLastOrigin(lastBarOriginPath, "/O3DE/bar"));
  425. EXPECT_EQ(tempRootFolder / filePath1, lastBarOriginPath);
  426. AZ::IO::Path lastBazOriginPath;
  427. ASSERT_TRUE(m_originTracker->FindLastOrigin(lastBazOriginPath, "/O3DE/baz"));
  428. EXPECT_EQ(tempRootFolder / filePath2, lastBazOriginPath);
  429. }
  430. } // namespace SettingsRegistryOriginTrackerTests