diff options
author | Diva Canto | 2010-11-29 09:57:41 -0800 |
---|---|---|
committer | Diva Canto | 2010-11-29 09:57:41 -0800 |
commit | 49b59fffee54bb7aa7db2382ba564c99368945d4 (patch) | |
tree | 28a352061fbaa41a2d29f15f41b284e3589f033a | |
parent | Preservation of creator information now also working in IARs. Cleaned up usag... (diff) | |
download | opensim-SC_OLD-49b59fffee54bb7aa7db2382ba564c99368945d4.zip opensim-SC_OLD-49b59fffee54bb7aa7db2382ba564c99368945d4.tar.gz opensim-SC_OLD-49b59fffee54bb7aa7db2382ba564c99368945d4.tar.bz2 opensim-SC_OLD-49b59fffee54bb7aa7db2382ba564c99368945d4.tar.xz |
Fix unit test.
4 files changed, 22 insertions, 9 deletions
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs index 53c35ff..7e3dd1b 100644 --- a/OpenSim/Framework/Serialization/External/OspResolver.cs +++ b/OpenSim/Framework/Serialization/External/OspResolver.cs | |||
@@ -57,6 +57,12 @@ namespace OpenSim.Framework.Serialization | |||
57 | /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> | 57 | /// <returns>The OSPA. Null if a user with the given UUID could not be found.</returns> |
58 | public static string MakeOspa(UUID userId, IUserAccountService userService) | 58 | public static string MakeOspa(UUID userId, IUserAccountService userService) |
59 | { | 59 | { |
60 | if (userService == null) | ||
61 | { | ||
62 | m_log.Warn("[OSP RESOLVER]: UserService is null"); | ||
63 | return userId.ToString(); | ||
64 | } | ||
65 | |||
60 | UserAccount account = userService.GetUserAccount(UUID.Zero, userId); | 66 | UserAccount account = userService.GetUserAccount(UUID.Zero, userId); |
61 | if (account != null) | 67 | if (account != null) |
62 | return MakeOspa(account.FirstName, account.LastName); | 68 | return MakeOspa(account.FirstName, account.LastName); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 870ead2..acf2c3e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
412 | { | 412 | { |
413 | item.CreatorIdAsUuid = m_userInfo.PrincipalID; | 413 | item.CreatorIdAsUuid = m_userInfo.PrincipalID; |
414 | } | 414 | } |
415 | 415 | ||
416 | item.Owner = m_userInfo.PrincipalID; | 416 | item.Owner = m_userInfo.PrincipalID; |
417 | 417 | ||
418 | // Reset folder ID to the one in which we want to load it | 418 | // Reset folder ID to the one in which we want to load it |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 421ea30..b33c2b1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -254,14 +254,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
254 | if (m_scenes.Count > 0) | 254 | if (m_scenes.Count > 0) |
255 | { | 255 | { |
256 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); | 256 | UserAccount userInfo = GetUserInfo(firstName, lastName, pass); |
257 | 257 | ||
258 | if (userInfo != null) | 258 | if (userInfo != null) |
259 | { | 259 | { |
260 | if (CheckPresence(userInfo.PrincipalID)) | 260 | if (CheckPresence(userInfo.PrincipalID)) |
261 | { | 261 | { |
262 | |||
262 | InventoryArchiveReadRequest request; | 263 | InventoryArchiveReadRequest request; |
263 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); | 264 | bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); |
264 | 265 | ||
265 | try | 266 | try |
266 | { | 267 | { |
267 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge); | 268 | request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge); |
@@ -275,7 +276,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
275 | 276 | ||
276 | return false; | 277 | return false; |
277 | } | 278 | } |
278 | 279 | ||
279 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); | 280 | UpdateClientWithLoadedNodes(userInfo, request.Execute()); |
280 | 281 | ||
281 | return true; | 282 | return true; |
@@ -287,6 +288,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
287 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); | 288 | userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); |
288 | } | 289 | } |
289 | } | 290 | } |
291 | else | ||
292 | m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", | ||
293 | firstName, lastName); | ||
290 | } | 294 | } |
291 | 295 | ||
292 | return false; | 296 | return false; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 1e39c39..2747e15 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -95,14 +95,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
95 | item1.Name = m_item1Name; | 95 | item1.Name = m_item1Name; |
96 | item1.AssetID = UUID.Random(); | 96 | item1.AssetID = UUID.Random(); |
97 | item1.GroupID = UUID.Random(); | 97 | item1.GroupID = UUID.Random(); |
98 | item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); | 98 | //item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); |
99 | //item1.CreatorId = userUuid.ToString(); | 99 | //item1.CreatorId = userUuid.ToString(); |
100 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | 100 | item1.CreatorId = m_ua2.PrincipalID.ToString(); |
101 | item1.Owner = UUID.Zero; | 101 | item1.Owner = UUID.Zero; |
102 | 102 | ||
103 | Scene scene = SceneSetupHelpers.SetupScene("Inventory"); | ||
104 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); | ||
105 | |||
103 | string item1FileName | 106 | string item1FileName |
104 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | 107 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); |
105 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), null)); | 108 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService)); |
106 | tar.Close(); | 109 | tar.Close(); |
107 | m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); | 110 | m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); |
108 | } | 111 | } |
@@ -385,7 +388,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
385 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 388 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
386 | 389 | ||
387 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 390 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
388 | 391 | ||
389 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); | 392 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); |
390 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); | 393 | UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); |
391 | 394 | ||