aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs50
1 files changed, 45 insertions, 5 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 4531bfd..2d80382 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -629,7 +629,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
629 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); 629 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
630 630
631 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 631 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
632 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 632 HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
633 633
634 string folder1Name = "1"; 634 string folder1Name = "1";
635 string folder2aName = "2a"; 635 string folder2aName = "2a";
@@ -644,7 +644,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
644 644
645 { 645 {
646 // Test replication of path1 646 // Test replication of path1
647 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 647 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
648 .ReplicateArchivePathToUserInventory( 648 .ReplicateArchivePathToUserInventory(
649 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 649 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
650 foldersCreated, nodesLoaded); 650 foldersCreated, nodesLoaded);
@@ -661,7 +661,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
661 661
662 { 662 {
663 // Test replication of path2 663 // Test replication of path2
664 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 664 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
665 .ReplicateArchivePathToUserInventory( 665 .ReplicateArchivePathToUserInventory(
666 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 666 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
667 foldersCreated, nodesLoaded); 667 foldersCreated, nodesLoaded);
@@ -707,10 +707,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
707 707
708 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 708 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
709 709
710 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 710 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
711 .ReplicateArchivePathToUserInventory( 711 .ReplicateArchivePathToUserInventory(
712 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 712 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
713 new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>()); 713 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
714 714
715 List<InventoryFolderBase> folder1PostCandidates 715 List<InventoryFolderBase> folder1PostCandidates
716 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 716 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
@@ -732,5 +732,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
732 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); 732 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
733 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 733 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
734 } 734 }
735
736 /// <summary>
737 /// Test replication of a partly existing archive path to the user's inventory. This should create
738 /// a merged path.
739 /// </summary>
740 [Test]
741 public void TestMergeIarPath()
742 {
743 TestHelper.InMethod();
744 log4net.Config.XmlConfigurator.Configure();
745
746 Scene scene = SceneSetupHelpers.SetupScene("inventory");
747 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
748
749 string folder1ExistingName = "a";
750 string folder2Name = "b";
751
752 InventoryFolderBase folder1
753 = UserInventoryTestUtils.CreateInventoryFolder(
754 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
755
756 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
757 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
758
759 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
760
761 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
762 .ReplicateArchivePathToUserInventory(
763 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
764 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
765
766 List<InventoryFolderBase> folder1PostCandidates
767 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
768 Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
769 Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
770
771 List<InventoryFolderBase> folder2PostCandidates
772 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
773 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
774 }
735 } 775 }
736} \ No newline at end of file 776} \ No newline at end of file