aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-05-28 21:37:48 +0100
committerJustin Clark-Casey (justincc)2010-05-28 21:37:48 +0100
commita60ca5236c247b88909a3c0462675627575b334c (patch)
tree1de95f0347da5e5566305561f30bbc601e7c0496 /OpenSim
parentminor: move a method so that the #regions make more sense (diff)
downloadopensim-SC_OLD-a60ca5236c247b88909a3c0462675627575b334c.zip
opensim-SC_OLD-a60ca5236c247b88909a3c0462675627575b334c.tar.gz
opensim-SC_OLD-a60ca5236c247b88909a3c0462675627575b334c.tar.bz2
opensim-SC_OLD-a60ca5236c247b88909a3c0462675627575b334c.tar.xz
restore InventoryArchiverTests.TestReplicateArchivePathToUserInventory() to work with the new UserAccountService/InventoryService
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs88
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs13
2 files changed, 49 insertions, 52 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index e434e46..d339543 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -540,55 +540,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
540 /// <summary> 540 /// <summary>
541 /// Test replication of an archive path to the user's inventory. 541 /// Test replication of an archive path to the user's inventory.
542 /// </summary> 542 /// </summary>
543// [Test] 543 [Test]
544// public void TestReplicateArchivePathToUserInventory() 544 public void TestReplicateArchivePathToUserInventory()
545// { 545 {
546// TestHelper.InMethod(); 546 TestHelper.InMethod();
547// //log4net.Config.XmlConfigurator.Configure(); 547 //log4net.Config.XmlConfigurator.Configure();
548// 548
549// Scene scene = SceneSetupHelpers.SetupScene("inventory"); 549 Scene scene = SceneSetupHelpers.SetupScene("inventory");
550// CommunicationsManager commsManager = scene.CommsManager; 550 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
551// CachedUserInfo userInfo; 551
552// 552 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
553// lock (this) 553 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
554// { 554
555// // !!! REFACTORING PROBLEM. This needs to be rewritten 555 string folder1Name = "a";
556// userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); 556 string folder2Name = "b";
557// Monitor.Wait(this, 60000); 557 string itemName = "c.lsl";
558// } 558
559// 559 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
560// //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); 560 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
561// 561 string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
562// Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); 562
563// List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 563 string itemArchivePath
564// 564 = string.Format(
565// string folder1Name = "a"; 565 "{0}{1}{2}{3}",
566// string folder2Name = "b"; 566 ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
567// string itemName = "c.lsl"; 567
568// 568 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
569// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); 569 .ReplicateArchivePathToUserInventory(
570// string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 570 itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
571// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); 571 foldersCreated, nodesLoaded);
572// 572
573// string itemArchivePath 573 InventoryFolderBase folder1
574// = string.Format( 574 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
575// "{0}{1}{2}{3}", 575 Assert.That(folder1, Is.Not.Null, "Could not find folder a");
576// ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); 576 InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
577// 577 Assert.That(folder2, Is.Not.Null, "Could not find folder b");
578// //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); 578 }
579//
580// new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
581// .ReplicateArchivePathToUserInventory(
582// itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
583// foldersCreated, nodesLoaded);
584//
585// //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
586// //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
587// InventoryFolderBase folder1
588// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
589// Assert.That(folder1, Is.Not.Null, "Could not find folder a");
590// InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
591// Assert.That(folder2, Is.Not.Null, "Could not find folder b");
592// }
593 } 579 }
594} 580} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index 2b14d97..a6b9520 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -27,7 +27,8 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework.Communications; 29using OpenSim.Framework.Communications;
30 30using OpenSim.Region.Framework.Scenes;
31using OpenSim.Services.Interfaces;
31 32
32namespace OpenSim.Tests.Common.Setup 33namespace OpenSim.Tests.Common.Setup
33{ 34{
@@ -113,5 +114,15 @@ namespace OpenSim.Tests.Common.Setup
113// 114//
114// return userInfo; 115// return userInfo;
115// } 116// }
117
118 public static UserAccount CreateUserWithInventory(Scene scene)
119 {
120 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
121 UserAccount ua = new UserAccount(userId) { FirstName = "Bill", LastName = "Bailey" };
122 scene.UserAccountService.StoreUserAccount(ua);
123 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
124
125 return ua;
126 }
116 } 127 }
117} \ No newline at end of file 128} \ No newline at end of file