diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 75 |
2 files changed, 52 insertions, 29 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 94c6ef9..9996074 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -246,9 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
246 | InventoryFolderBase rootDestFolder, | 246 | InventoryFolderBase rootDestFolder, |
247 | ref string archivePath, | 247 | ref string archivePath, |
248 | Dictionary <string, InventoryFolderBase> resolvedFolders) | 248 | Dictionary <string, InventoryFolderBase> resolvedFolders) |
249 | { | 249 | { |
250 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Resolving destination folder {0}", archivePath); | ||
251 | |||
252 | string originalArchivePath = archivePath; | 250 | string originalArchivePath = archivePath; |
253 | 251 | ||
254 | InventoryFolderBase destFolder = null; | 252 | InventoryFolderBase destFolder = null; |
@@ -257,6 +255,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
257 | { | 255 | { |
258 | while (null == destFolder && archivePath.Length > 0) | 256 | while (null == destFolder && archivePath.Length > 0) |
259 | { | 257 | { |
258 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); | ||
259 | |||
260 | if (resolvedFolders.ContainsKey(archivePath)) | 260 | if (resolvedFolders.ContainsKey(archivePath)) |
261 | { | 261 | { |
262 | m_log.DebugFormat( | 262 | m_log.DebugFormat( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 85afbf9..5130fa5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
279 | public void TestIarV0_1WithEscapedChars() | 279 | public void TestIarV0_1WithEscapedChars() |
280 | { | 280 | { |
281 | TestHelper.InMethod(); | 281 | TestHelper.InMethod(); |
282 | log4net.Config.XmlConfigurator.Configure(); | 282 | // log4net.Config.XmlConfigurator.Configure(); |
283 | 283 | ||
284 | string itemName = "You & you are a mean/man/"; | 284 | string itemName = "You & you are a mean/man/"; |
285 | string humanEscapedItemName = @"You & you are a mean\/man\/"; | 285 | string humanEscapedItemName = @"You & you are a mean\/man\/"; |
@@ -508,7 +508,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
508 | public void TestNewIarPath() | 508 | public void TestNewIarPath() |
509 | { | 509 | { |
510 | TestHelper.InMethod(); | 510 | TestHelper.InMethod(); |
511 | //log4net.Config.XmlConfigurator.Configure(); | 511 | // log4net.Config.XmlConfigurator.Configure(); |
512 | 512 | ||
513 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); | 513 | Scene scene = SceneSetupHelpers.SetupScene("inventory"); |
514 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); | 514 | UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); |
@@ -516,29 +516,55 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
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 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); |
518 | 518 | ||
519 | string folder1Name = "a"; | 519 | string folder1Name = "1"; |
520 | string folder2Name = "b"; | 520 | string folder2aName = "2a"; |
521 | string itemName = "c.lsl"; | 521 | string folder2bName = "2b"; |
522 | 522 | ||
523 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); | 523 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); |
524 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | 524 | string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); |
525 | string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); | 525 | string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); |
526 | 526 | ||
527 | string itemArchivePath | 527 | string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); |
528 | = string.Format( | 528 | string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); |
529 | "{0}{1}{2}{3}", | ||
530 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); | ||
531 | 529 | ||
532 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) | 530 | { |
533 | .ReplicateArchivePathToUserInventory( | 531 | // Test replication of path1 |
534 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 532 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) |
535 | foldersCreated, nodesLoaded); | 533 | .ReplicateArchivePathToUserInventory( |
536 | 534 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | |
537 | InventoryFolderBase folder1 | 535 | foldersCreated, nodesLoaded); |
538 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a")[0]; | 536 | |
539 | Assert.That(folder1, Is.Not.Null, "Could not find folder a"); | 537 | List<InventoryFolderBase> folder1Candidates |
540 | InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b")[0]; | 538 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); |
541 | Assert.That(folder2, Is.Not.Null, "Could not find folder b"); | 539 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); |
540 | |||
541 | InventoryFolderBase folder1 = folder1Candidates[0]; | ||
542 | List<InventoryFolderBase> folder2aCandidates | ||
543 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); | ||
544 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); | ||
545 | } | ||
546 | |||
547 | { | ||
548 | // Test replication of path2 | ||
549 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) | ||
550 | .ReplicateArchivePathToUserInventory( | ||
551 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | ||
552 | foldersCreated, nodesLoaded); | ||
553 | |||
554 | List<InventoryFolderBase> folder1Candidates | ||
555 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); | ||
556 | Assert.That(folder1Candidates.Count, Is.EqualTo(1)); | ||
557 | |||
558 | InventoryFolderBase folder1 = folder1Candidates[0]; | ||
559 | |||
560 | List<InventoryFolderBase> folder2aCandidates | ||
561 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); | ||
562 | Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); | ||
563 | |||
564 | List<InventoryFolderBase> folder2bCandidates | ||
565 | = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); | ||
566 | Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); | ||
567 | } | ||
542 | } | 568 | } |
543 | 569 | ||
544 | /// <summary> | 570 | /// <summary> |
@@ -564,11 +590,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
564 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); | 590 | string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); |
565 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); | 591 | string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); |
566 | 592 | ||
567 | string itemArchivePath | 593 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
568 | = string.Format( | 594 | |
569 | "{0}{1}{2}", | ||
570 | ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName); | ||
571 | |||
572 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) | 595 | new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null) |
573 | .ReplicateArchivePathToUserInventory( | 596 | .ReplicateArchivePathToUserInventory( |
574 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 597 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |