From d4ed7b03af5079d1ec9837de1aa8ca7becc300c9 Mon Sep 17 00:00:00 2001 From: Arthur Valadares Date: Thu, 11 Jun 2009 20:50:23 +0000 Subject: * Fixed a few more async calls. Still not uncommented, some asserts still failing --- .../Archiver/InventoryArchiveReadRequest.cs | 7 +++++ .../Archiver/Tests/InventoryArchiverTests.cs | 36 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 694b887..13b1f5a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.IO; using System.IO.Compression; using System.Reflection; +using System.Threading; using System.Text; using System.Xml; using log4net; @@ -116,6 +117,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver else { m_userInfo.FetchInventory(); + for (int i = 0 ; i < 50 ; i++) + { + if (m_userInfo.HasReceivedInventory == true) + break; + Thread.Sleep(200); + } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 1e300f5..dd524f5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -85,7 +85,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests cm.UserAdminService.AddUser(userFirstName, userLastName, string.Empty, string.Empty, 1000, 1000, userId); CachedUserInfo userInfo = cm.UserProfileCacheService.GetUserDetails(userId); userInfo.FetchInventory(); - while (!userInfo.HasReceivedInventory){ }; + for (int i = 0 ; i < 50 ; i++) + { + if (userInfo.HasReceivedInventory == true) + break; + Thread.Sleep(200); + } + Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); // Create asset SceneObjectGroup object1; @@ -248,9 +254,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); CachedUserInfo userInfo - = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); + = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); + userInfo.FetchInventory(); + for (int i = 0 ; i < 50 ; i++) + { + if (userInfo.HasReceivedInventory == true) + break; + Thread.Sleep(200); + } + Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); - + Assert.That(foundItem, Is.Not.Null); Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId)); Assert.That(foundItem.CreatorIdAsUuid, Is.EqualTo(user2Uuid)); Assert.That(foundItem.Owner, Is.EqualTo(userUuid)); @@ -318,6 +332,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); + userInfo.FetchInventory(); + for (int i = 0 ; i < 50 ; i++) + { + if (userInfo.HasReceivedInventory == true) + break; + Thread.Sleep(200); + } + Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName); Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId)); @@ -339,6 +361,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests CommunicationsManager commsManager = scene.CommsManager; CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); + userInfo.FetchInventory(); + for (int i = 0 ; i < 50 ; i++) + { + if (userInfo.HasReceivedInventory == true) + break; + Thread.Sleep(200); + } + Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); Dictionary foldersCreated = new Dictionary(); List nodesLoaded = new List(); -- cgit v1.1