aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs65
2 files changed, 17 insertions, 50 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 6030706..7849d88 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -400,6 +400,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); 400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
401 if (UUID.Zero != ospResolvedId) // The user exists in this grid 401 if (UUID.Zero != ospResolvedId) // The user exists in this grid
402 { 402 {
403// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
404
403 item.CreatorIdAsUuid = ospResolvedId; 405 item.CreatorIdAsUuid = ospResolvedId;
404 406
405 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the 407 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 8a84c7a..de95505 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -97,6 +97,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
97 97
98 protected void ConstructDefaultIarBytesForTestLoad() 98 protected void ConstructDefaultIarBytesForTestLoad()
99 { 99 {
100// log4net.Config.XmlConfigurator.Configure();
101
102 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
103 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
104
100 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); 105 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
101 106
102 MemoryStream archiveWriteStream = new MemoryStream(); 107 MemoryStream archiveWriteStream = new MemoryStream();
@@ -106,14 +111,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
106 item1.Name = m_item1Name; 111 item1.Name = m_item1Name;
107 item1.AssetID = UUID.Random(); 112 item1.AssetID = UUID.Random();
108 item1.GroupID = UUID.Random(); 113 item1.GroupID = UUID.Random();
109 //item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName); 114 item1.CreatorIdAsUuid = m_ua2.PrincipalID;
110 //item1.CreatorId = userUuid.ToString();
111 item1.CreatorId = m_ua2.PrincipalID.ToString();
112 item1.Owner = UUID.Zero; 115 item1.Owner = UUID.Zero;
113 116
114 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
115 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
116
117 string item1FileName 117 string item1FileName
118 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 118 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
119 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService)); 119 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
390 public void TestLoadIarV0_1ExistingUsers() 390 public void TestLoadIarV0_1ExistingUsers()
391 { 391 {
392 TestHelper.InMethod(); 392 TestHelper.InMethod();
393 //log4net.Config.XmlConfigurator.Configure(); 393// log4net.Config.XmlConfigurator.Configure();
394 394
395 SerialiserModule serialiserModule = new SerialiserModule(); 395 SerialiserModule serialiserModule = new SerialiserModule();
396 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 396 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
@@ -414,9 +414,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
414// Assert.That( 414// Assert.That(
415// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 415// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
416// "Loaded item non-uuid creator doesn't match original"); 416// "Loaded item non-uuid creator doesn't match original");
417 Assert.That( 417// Assert.That(
418 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()), 418// foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
419 "Loaded item non-uuid creator doesn't match original"); 419// "Loaded item non-uuid creator doesn't match original");
420 420
421 Assert.That( 421 Assert.That(
422 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID), 422 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
@@ -529,64 +529,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
529 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 529 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
530 /// embedded creators do not exist in the system 530 /// embedded creators do not exist in the system
531 /// </summary> 531 /// </summary>
532 ///
533 /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
534 /// (as tested in the a later commented out test)
535 /// This test is currently disabled
536 [Test] 532 [Test]
537 public void TestLoadIarV0_1AbsentUsers() 533 public void TestLoadIarV0_1AbsentUsers()
538 { 534 {
539 TestHelper.InMethod(); 535 TestHelper.InMethod();
540 //log4net.Config.XmlConfigurator.Configure(); 536// log4net.Config.XmlConfigurator.Configure();
541
542 string userFirstName = "Charlie";
543 string userLastName = "Chan";
544 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
545 string userItemCreatorFirstName = "Bat";
546 string userItemCreatorLastName = "Man";
547 //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
548
549 string itemName = "b.lsl";
550 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
551
552 MemoryStream archiveWriteStream = new MemoryStream();
553 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
554
555 InventoryItemBase item1 = new InventoryItemBase();
556 item1.Name = itemName;
557 item1.AssetID = UUID.Random();
558 item1.GroupID = UUID.Random();
559 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
560 //item1.CreatorId = userUuid.ToString();
561 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
562 item1.Owner = UUID.Zero;
563 537
564 string item1FileName
565 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
566 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null));
567 tar.Close();
568
569 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
570 SerialiserModule serialiserModule = new SerialiserModule(); 538 SerialiserModule serialiserModule = new SerialiserModule();
571 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 539 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
572
573 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
574 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 540 Scene scene = SceneSetupHelpers.SetupScene("inventory");
575
576 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 541 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
577 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
578 542
579 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 543 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
544 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "password", m_iarStream);
580 545
581 InventoryItemBase foundItem1 546 InventoryItemBase foundItem1
582 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName); 547 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
583 548
584 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 549 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
585// Assert.That( 550// Assert.That(
586// foundItem1.CreatorId, Is.EqualTo(userUuid), 551// foundItem1.CreatorId, Is.EqualTo(userUuid),
587// "Loaded item non-uuid creator doesn't match that of the loading user"); 552// "Loaded item non-uuid creator doesn't match that of the loading user");
588 Assert.That( 553 Assert.That(
589 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), 554 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua1.PrincipalID),
590 "Loaded item uuid creator doesn't match that of the loading user"); 555 "Loaded item uuid creator doesn't match that of the loading user");
591 } 556 }
592 557