restore InventoryArchiverTests.TestReplicateArchivePathToUserInventory() to work with the new UserAccountService/InventoryService

soprefactor
Justin Clark-Casey (justincc) 2010-05-28 21:37:48 +01:00
parent 0ef41e62bc
commit a60ca5236c
2 changed files with 49 additions and 52 deletions

View File

@ -540,55 +540,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
/// <summary> /// <summary>
/// Test replication of an archive path to the user's inventory. /// Test replication of an archive path to the user's inventory.
/// </summary> /// </summary>
// [Test] [Test]
// public void TestReplicateArchivePathToUserInventory() public void TestReplicateArchivePathToUserInventory()
// { {
// TestHelper.InMethod(); TestHelper.InMethod();
// //log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
//
// Scene scene = SceneSetupHelpers.SetupScene("inventory"); Scene scene = SceneSetupHelpers.SetupScene("inventory");
// CommunicationsManager commsManager = scene.CommsManager; UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
// CachedUserInfo userInfo;
// Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
// lock (this) List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
// {
// // !!! REFACTORING PROBLEM. This needs to be rewritten string folder1Name = "a";
// userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager, InventoryReceived); string folder2Name = "b";
// Monitor.Wait(this, 60000); string itemName = "c.lsl";
// }
// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
// //Console.WriteLine("userInfo.RootFolder 1: {0}", userInfo.RootFolder); string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
// Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
// List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); string itemArchivePath
// = string.Format(
// string folder1Name = "a"; "{0}{1}{2}{3}",
// string folder2Name = "b"; ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName);
// string itemName = "c.lsl";
// new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null)
// string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random()); .ReplicateArchivePathToUserInventory(
// string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); itemArchivePath, false, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
// string itemArchiveName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random()); foldersCreated, nodesLoaded);
//
// string itemArchivePath InventoryFolderBase folder1
// = string.Format( = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, "a");
// "{0}{1}{2}{3}", Assert.That(folder1, Is.Not.Null, "Could not find folder a");
// ArchiveConstants.INVENTORY_PATH, folder1ArchiveName, folder2ArchiveName, itemArchiveName); InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
// Assert.That(folder2, Is.Not.Null, "Could not find folder b");
// //Console.WriteLine("userInfo.RootFolder 2: {0}", userInfo.RootFolder); }
//
// new InventoryArchiveReadRequest(scene, userInfo, null, (Stream)null)
// .ReplicateArchivePathToUserInventory(
// itemArchivePath, false, scene.InventoryService.GetRootFolder(userInfo.UserProfile.ID),
// foldersCreated, nodesLoaded);
//
// //Console.WriteLine("userInfo.RootFolder 3: {0}", userInfo.RootFolder);
// //InventoryFolderImpl folder1 = userInfo.RootFolder.FindFolderByPath("a");
// InventoryFolderBase folder1
// = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userInfo.UserProfile.ID, "a");
// Assert.That(folder1, Is.Not.Null, "Could not find folder a");
// InventoryFolderBase folder2 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, "b");
// Assert.That(folder2, Is.Not.Null, "Could not find folder b");
// }
} }
} }

View File

@ -27,7 +27,8 @@
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Setup namespace OpenSim.Tests.Common.Setup
{ {
@ -113,5 +114,15 @@ namespace OpenSim.Tests.Common.Setup
// //
// return userInfo; // return userInfo;
// } // }
public static UserAccount CreateUserWithInventory(Scene scene)
{
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
UserAccount ua = new UserAccount(userId) { FirstName = "Bill", LastName = "Bailey" };
scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID);
return ua;
}
} }
} }