diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 79 |
2 files changed, 78 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 50c0f93..2a1c82e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -177,6 +177,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
177 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); | 177 | UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager); |
178 | if (UUID.Zero != ospResolvedId) | 178 | if (UUID.Zero != ospResolvedId) |
179 | item.CreatorIdAsUuid = ospResolvedId; | 179 | item.CreatorIdAsUuid = ospResolvedId; |
180 | else | ||
181 | item.CreatorIdAsUuid = m_userInfo.UserProfile.ID; | ||
180 | 182 | ||
181 | item.Owner = m_userInfo.UserProfile.ID; | 183 | item.Owner = m_userInfo.UserProfile.ID; |
182 | 184 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 384a1f2..9c5f8f3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
81 | public void TestSaveIarV0_1() | 81 | public void TestSaveIarV0_1() |
82 | { | 82 | { |
83 | TestHelper.InMethod(); | 83 | TestHelper.InMethod(); |
84 | log4net.Config.XmlConfigurator.Configure(); | 84 | //log4net.Config.XmlConfigurator.Configure(); |
85 | 85 | ||
86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 86 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
87 | 87 | ||
@@ -202,12 +202,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
202 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 202 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
203 | /// an account exists with the creator name. | 203 | /// an account exists with the creator name. |
204 | /// </summary> | 204 | /// </summary> |
205 | /// | ||
206 | /// This test also does some deeper probing of loading into nested inventory structures | ||
205 | [Test] | 207 | [Test] |
206 | public void TestLoadIarV0_1ExistingUsers() | 208 | public void TestLoadIarV0_1ExistingUsers() |
207 | { | 209 | { |
208 | TestHelper.InMethod(); | 210 | TestHelper.InMethod(); |
209 | 211 | ||
210 | log4net.Config.XmlConfigurator.Configure(); | 212 | //log4net.Config.XmlConfigurator.Configure(); |
211 | 213 | ||
212 | string userFirstName = "Mr"; | 214 | string userFirstName = "Mr"; |
213 | string userLastName = "Tiddles"; | 215 | string userLastName = "Tiddles"; |
@@ -291,6 +293,77 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
291 | 293 | ||
292 | /// <summary> | 294 | /// <summary> |
293 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 295 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
296 | /// embedded creators do not exist in the system | ||
297 | /// </summary> | ||
298 | /// | ||
299 | /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature | ||
300 | /// (as tested in the a later commented out test) | ||
301 | [Test] | ||
302 | public void TestLoadIarV0_1AbsentUsers() | ||
303 | { | ||
304 | TestHelper.InMethod(); | ||
305 | |||
306 | log4net.Config.XmlConfigurator.Configure(); | ||
307 | |||
308 | string userFirstName = "Charlie"; | ||
309 | string userLastName = "Chan"; | ||
310 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); | ||
311 | string userItemCreatorFirstName = "Bat"; | ||
312 | string userItemCreatorLastName = "Man"; | ||
313 | //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); | ||
314 | |||
315 | string itemName = "b.lsl"; | ||
316 | string archiveItemName | ||
317 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); | ||
318 | |||
319 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
320 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | ||
321 | |||
322 | InventoryItemBase item1 = new InventoryItemBase(); | ||
323 | item1.Name = itemName; | ||
324 | item1.AssetID = UUID.Random(); | ||
325 | item1.GroupID = UUID.Random(); | ||
326 | item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); | ||
327 | //item1.CreatorId = userUuid.ToString(); | ||
328 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | ||
329 | item1.Owner = UUID.Zero; | ||
330 | |||
331 | string item1FileName | ||
332 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | ||
333 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | ||
334 | tar.Close(); | ||
335 | |||
336 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
337 | SerialiserModule serialiserModule = new SerialiserModule(); | ||
338 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | ||
339 | |||
340 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | ||
341 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | ||
342 | IUserAdminService userAdminService = scene.CommsManager.UserAdminService; | ||
343 | |||
344 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
345 | userAdminService.AddUser( | ||
346 | userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); | ||
347 | |||
348 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); | ||
349 | |||
350 | CachedUserInfo userInfo | ||
351 | = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | ||
352 | |||
353 | InventoryItemBase foundItem1 | ||
354 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); | ||
355 | |||
356 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | ||
357 | // Assert.That( | ||
358 | // foundItem1.CreatorId, Is.EqualTo(userUuid), | ||
359 | // "Loaded item non-uuid creator doesn't match that of the loading user"); | ||
360 | Assert.That( | ||
361 | foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), | ||
362 | "Loaded item uuid creator doesn't match that of the loading user"); | ||
363 | } | ||
364 | |||
365 | /// <summary> | ||
366 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | ||
294 | /// no account exists with the creator name | 367 | /// no account exists with the creator name |
295 | /// </summary> | 368 | /// </summary> |
296 | /// Disabled since temporary profiles have not yet been implemented. | 369 | /// Disabled since temporary profiles have not yet been implemented. |
@@ -376,7 +449,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
376 | { | 449 | { |
377 | TestHelper.InMethod(); | 450 | TestHelper.InMethod(); |
378 | 451 | ||
379 | log4net.Config.XmlConfigurator.Configure(); | 452 | //log4net.Config.XmlConfigurator.Configure(); |
380 | 453 | ||
381 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 454 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
382 | CommunicationsManager commsManager = scene.CommsManager; | 455 | CommunicationsManager commsManager = scene.CommsManager; |