From 304c78bbbbc9a176d70d2967a3f703f2e545565c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sun, 6 Sep 2009 19:30:03 +0100 Subject: Temporarily re-enable save iar test by manually insert the item into the old cache during the test --- .../Inventory/Archiver/InventoryArchiveWriteRequest.cs | 7 +++++++ .../Inventory/Archiver/Tests/InventoryArchiverTests.cs | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 18728c6..6653516 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -207,6 +207,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryFolderImpl inventoryFolder = null; InventoryItemBase inventoryItem = null; + // XXX: Very temporarily, drop and refetch inventory to make sure we have any newly created items in cache + // This will disappear very soon once we stop using the old cached inventory. + /* + m_userInfo.DropInventory(); + m_userInfo.FetchInventory(); + */ + if (!m_userInfo.HasReceivedInventory) { // If the region server has access to the user admin service (by which users are created), diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index a151c9d..2ad6f1a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -77,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests /// // Commenting for now! The mock inventory service needs more beef, at least for // GetFolderForType - //[Test] + [Test] public void TestSaveIarV0_1() { TestHelper.InMethod(); @@ -93,11 +93,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests string userFirstName = "Jock"; string userLastName = "Stirrup"; UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); - // CachedUserInfo userInfo; + CachedUserInfo userInfo; lock (this) { - UserProfileTestUtils.CreateUserWithInventory( + userInfo = UserProfileTestUtils.CreateUserWithInventory( cm, userFirstName, userLastName, userId, InventoryReceived); Monitor.Wait(this, 60000); } @@ -136,18 +136,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests item1.Name = "My Little Dog"; item1.AssetID = asset1.FullID; item1.ID = item1Id; - //userInfo.RootFolder.FindFolderByPath("Objects").ID; + InventoryFolderImpl objsFolder = userInfo.RootFolder.FindFolderByPath("Objects"); //InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); Console.WriteLine("here2"); + /* IInventoryService inventoryService = scene.InventoryService; InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); InventoryCollection rootContents = inventoryService.GetFolderContent(userId, rootFolder.ID); + */ + /* InventoryFolderBase objsFolder = null; foreach (InventoryFolderBase folder in rootContents.Folders) if (folder.Name == "Objects") objsFolder = folder; + */ item1.Folder = objsFolder.ID; scene.AddInventoryItem(userId, item1); + userInfo.AddItem(item1); MemoryStream archiveWriteStream = new MemoryStream(); archiverModule.OnInventoryArchiveSaved += SaveCompleted; @@ -155,7 +160,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests mre.Reset(); archiverModule.ArchiveInventory( Guid.NewGuid(), userFirstName, userLastName, "Objects", archiveWriteStream); - mre.WaitOne(); + mre.WaitOne(60000, false); byte[] archive = archiveWriteStream.ToArray(); MemoryStream archiveReadStream = new MemoryStream(archive); -- cgit v1.1