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 5130fa5..5fad0a9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -514,7 +514,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
514 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); 514 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
515 515
516 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 516 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
517 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 517 HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
518 518
519 string folder1Name = "1"; 519 string folder1Name = "1";
520 string folder2aName = "2a"; 520 string folder2aName = "2a";
@@ -529,7 +529,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
529 529
530 { 530 {
531 // Test replication of path1 531 // Test replication of path1
532 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 532 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
533 .ReplicateArchivePathToUserInventory( 533 .ReplicateArchivePathToUserInventory(
534 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 534 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
535 foldersCreated, nodesLoaded); 535 foldersCreated, nodesLoaded);
@@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
546 546
547 { 547 {
548 // Test replication of path2 548 // Test replication of path2
549 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 549 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
550 .ReplicateArchivePathToUserInventory( 550 .ReplicateArchivePathToUserInventory(
551 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 551 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
552 foldersCreated, nodesLoaded); 552 foldersCreated, nodesLoaded);
@@ -592,10 +592,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
592 592
593 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); 593 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
594 594
595 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) 595 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
596 .ReplicateArchivePathToUserInventory( 596 .ReplicateArchivePathToUserInventory(
597 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), 597 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
598 new Dictionary<string, InventoryFolderBase>(), new List<InventoryNodeBase>()); 598 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
599 599
600 List<InventoryFolderBase> folder1PostCandidates 600 List<InventoryFolderBase> folder1PostCandidates
601 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 601 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
@@ -617,5 +617,45 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
617 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); 617 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
618 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 618 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
619 } 619 }
620
621 /// <summary>
622 /// Test replication of a partly existing archive path to the user's inventory. This should create
623 /// a merged path.
624 /// </summary>
625 [Test]
626 public void TestMergeIarPath()
627 {
628 TestHelper.InMethod();
629 log4net.Config.XmlConfigurator.Configure();
630
631 Scene scene = SceneSetupHelpers.SetupScene("inventory");
632 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
633
634 string folder1ExistingName = "a";
635 string folder2Name = "b";
636
637 InventoryFolderBase folder1
638 = UserInventoryTestUtils.CreateInventoryFolder(
639 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
640
641 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
642 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
643
644 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
645
646 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
647 .ReplicateArchivePathToUserInventory(
648 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
649 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
650
651 List<InventoryFolderBase> folder1PostCandidates
652 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
653 Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
654 Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
655
656 List<InventoryFolderBase> folder2PostCandidates
657 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
658 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
659 }
620 } 660 }
621} \ No newline at end of file 661} \ No newline at end of file