diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 119 |
1 files changed, 56 insertions, 63 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 3c4bc7b..507662f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -364,76 +364,69 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
364 | /// | 364 | /// |
365 | /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature | 365 | /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature |
366 | /// (as tested in the a later commented out test) | 366 | /// (as tested in the a later commented out test) |
367 | /// REFACTORING PROBLEM. Needs rewrite. | 367 | /// This test is currently disabled |
368 | // [Test] | 368 | [Test] |
369 | // public void TestLoadIarV0_1AbsentUsers() | 369 | public void TestLoadIarV0_1AbsentUsers() |
370 | // { | 370 | { |
371 | // TestHelper.InMethod(); | 371 | TestHelper.InMethod(); |
372 | 372 | //log4net.Config.XmlConfigurator.Configure(); | |
373 | // //log4net.Config.XmlConfigurator.Configure(); | 373 | |
374 | 374 | string userFirstName = "Charlie"; | |
375 | // string userFirstName = "Charlie"; | 375 | string userLastName = "Chan"; |
376 | // string userLastName = "Chan"; | 376 | UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); |
377 | // UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999"); | 377 | string userItemCreatorFirstName = "Bat"; |
378 | // string userItemCreatorFirstName = "Bat"; | 378 | string userItemCreatorLastName = "Man"; |
379 | // string userItemCreatorLastName = "Man"; | 379 | //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); |
380 | // //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888"); | 380 | |
381 | 381 | string itemName = "b.lsl"; | |
382 | // string itemName = "b.lsl"; | 382 | string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); |
383 | // string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); | 383 | |
384 | 384 | MemoryStream archiveWriteStream = new MemoryStream(); | |
385 | // MemoryStream archiveWriteStream = new MemoryStream(); | 385 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
386 | // TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 386 | |
387 | 387 | InventoryItemBase item1 = new InventoryItemBase(); | |
388 | // InventoryItemBase item1 = new InventoryItemBase(); | 388 | item1.Name = itemName; |
389 | // item1.Name = itemName; | 389 | item1.AssetID = UUID.Random(); |
390 | // item1.AssetID = UUID.Random(); | 390 | item1.GroupID = UUID.Random(); |
391 | // item1.GroupID = UUID.Random(); | 391 | item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); |
392 | // item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName); | 392 | //item1.CreatorId = userUuid.ToString(); |
393 | // //item1.CreatorId = userUuid.ToString(); | 393 | //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; |
394 | // //item1.CreatorId = "00000000-0000-0000-0000-000000000444"; | 394 | item1.Owner = UUID.Zero; |
395 | // item1.Owner = UUID.Zero; | 395 | |
396 | 396 | string item1FileName | |
397 | // string item1FileName | 397 | = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); |
398 | // = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); | 398 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); |
399 | // tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); | 399 | tar.Close(); |
400 | // tar.Close(); | 400 | |
401 | 401 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | |
402 | // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 402 | SerialiserModule serialiserModule = new SerialiserModule(); |
403 | // SerialiserModule serialiserModule = new SerialiserModule(); | 403 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); |
404 | // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); | 404 | |
405 | 405 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | |
406 | // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | 406 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
407 | // Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 407 | |
408 | // IUserAdminService userAdminService = scene.CommsManager.UserAdminService; | 408 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
409 | 409 | UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); | |
410 | // SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 410 | |
411 | // userAdminService.AddUser( | 411 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); |
412 | // userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid); | 412 | |
413 | 413 | InventoryItemBase foundItem1 | |
414 | // archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); | 414 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName); |
415 | 415 | ||
416 | // CachedUserInfo userInfo | 416 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
417 | // = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); | ||
418 | |||
419 | // InventoryItemBase foundItem1 | ||
420 | // = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userInfo.UserProfile.ID, itemName); | ||
421 | |||
422 | // Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | ||
423 | //// Assert.That( | ||
424 | //// foundItem1.CreatorId, Is.EqualTo(userUuid), | ||
425 | //// "Loaded item non-uuid creator doesn't match that of the loading user"); | ||
426 | // Assert.That( | 417 | // Assert.That( |
427 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), | 418 | // foundItem1.CreatorId, Is.EqualTo(userUuid), |
428 | // "Loaded item uuid creator doesn't match that of the loading user"); | 419 | // "Loaded item non-uuid creator doesn't match that of the loading user"); |
429 | // } | 420 | Assert.That( |
421 | foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), | ||
422 | "Loaded item uuid creator doesn't match that of the loading user"); | ||
423 | } | ||
430 | 424 | ||
431 | /// <summary> | 425 | /// <summary> |
432 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 426 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
433 | /// no account exists with the creator name | 427 | /// no account exists with the creator name |
434 | /// </summary> | 428 | /// </summary> |
435 | /// Disabled since temporary profiles have not yet been implemented. | 429 | /// Disabled since temporary profiles have not yet been implemented. |
436 | /// REFACTORING PROBLEM. Needs rewrite. | ||
437 | /// | 430 | /// |
438 | //[Test] | 431 | //[Test] |
439 | //public void TestLoadIarV0_1TempProfiles() | 432 | //public void TestLoadIarV0_1TempProfiles() |