diff options
author | Diva Canto | 2009-08-11 10:51:49 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-11 10:51:49 -0700 |
commit | dc897b228826c5e5c9db62e13fd9cb6872ff15b6 (patch) | |
tree | da499f946125f00291e23c72c468a2bff579551c /OpenSim/Framework/Communications | |
parent | Improved test for system folders. Removed log messages. (diff) | |
parent | Re-enable TestReplicateArchivePathToUserInventory() but stop it failing on th... (diff) | |
download | opensim-SC-dc897b228826c5e5c9db62e13fd9cb6872ff15b6.zip opensim-SC-dc897b228826c5e5c9db62e13fd9cb6872ff15b6.tar.gz opensim-SC-dc897b228826c5e5c9db62e13fd9cb6872ff15b6.tar.bz2 opensim-SC-dc897b228826c5e5c9db62e13fd9cb6872ff15b6.tar.xz |
Merged with origin, and resolved one conflict in LoginServiceTests.cs
Diffstat (limited to 'OpenSim/Framework/Communications')
4 files changed, 83 insertions, 56 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 10aff42..8ee1b1a 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -49,16 +49,24 @@ namespace OpenSim.Framework.Communications.Cache | |||
49 | IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); | 49 | IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems); |
50 | 50 | ||
51 | public delegate void OnItemReceivedDelegate(UUID itemID); | 51 | public delegate void OnItemReceivedDelegate(UUID itemID); |
52 | public delegate void OnInventoryReceivedDelegate(UUID userID); | ||
52 | 53 | ||
53 | /// <summary> | 54 | /// <summary> |
54 | /// Stores user profile and inventory data received from backend services for a particular user. | 55 | /// Stores user profile and inventory data received from backend services for a particular user. |
55 | /// </summary> | 56 | /// </summary> |
56 | public class CachedUserInfo | 57 | public class CachedUserInfo |
57 | { | 58 | { |
59 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
60 | |||
61 | //// <value> | ||
62 | /// Fired when a particular item has been received from the inventory service | ||
63 | /// </value> | ||
58 | public event OnItemReceivedDelegate OnItemReceived; | 64 | public event OnItemReceivedDelegate OnItemReceived; |
59 | 65 | ||
60 | private static readonly ILog m_log | 66 | /// <value> |
61 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 67 | /// Fired once the entire inventory has been received for the user |
68 | /// </value> | ||
69 | public event OnInventoryReceivedDelegate OnInventoryReceived; | ||
62 | 70 | ||
63 | /// <summary> | 71 | /// <summary> |
64 | /// The comms manager holds references to services (user, grid, inventory, etc.) | 72 | /// The comms manager holds references to services (user, grid, inventory, etc.) |
@@ -133,7 +141,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
133 | UUID parentFolderId = folder.ParentID; | 141 | UUID parentFolderId = folder.ParentID; |
134 | 142 | ||
135 | if (dictionary.ContainsKey(parentFolderId)) | 143 | if (dictionary.ContainsKey(parentFolderId)) |
144 | { | ||
136 | dictionary[parentFolderId].Add(folder); | 145 | dictionary[parentFolderId].Add(folder); |
146 | } | ||
137 | else | 147 | else |
138 | { | 148 | { |
139 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 149 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
@@ -299,6 +309,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
299 | request.Execute(); | 309 | request.Execute(); |
300 | } | 310 | } |
301 | } | 311 | } |
312 | |||
313 | if (OnInventoryReceived != null) | ||
314 | OnInventoryReceived(UserProfile.ID); | ||
302 | } | 315 | } |
303 | 316 | ||
304 | /// <summary> | 317 | /// <summary> |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index fdc20dd..fe88cf5 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -43,6 +43,18 @@ namespace OpenSim.Framework.Communications.Tests | |||
43 | [TestFixture] | 43 | [TestFixture] |
44 | public class UserProfileCacheServiceTests | 44 | public class UserProfileCacheServiceTests |
45 | { | 45 | { |
46 | /// <value>Used by tests to indicate whether an async operation timed out</value> | ||
47 | private bool timedOut; | ||
48 | |||
49 | private void InventoryReceived(UUID userId) | ||
50 | { | ||
51 | lock (this) | ||
52 | { | ||
53 | timedOut = false; | ||
54 | Monitor.PulseAll(this); | ||
55 | } | ||
56 | } | ||
57 | |||
46 | [Test] | 58 | [Test] |
47 | public void TestGetUserDetails() | 59 | public void TestGetUserDetails() |
48 | { | 60 | { |
@@ -54,6 +66,7 @@ namespace OpenSim.Framework.Communications.Tests | |||
54 | CachedUserInfo nonExistingUserInfo; | 66 | CachedUserInfo nonExistingUserInfo; |
55 | 67 | ||
56 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); | 68 | TestCommunicationsManager commsManager = new TestCommunicationsManager(); |
69 | Scene myScene = SceneSetupHelpers.SetupScene(commsManager, ""); | ||
57 | 70 | ||
58 | // Check we can't retrieve info before it exists by uuid | 71 | // Check we can't retrieve info before it exists by uuid |
59 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); | 72 | nonExistingUserInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); |
@@ -116,15 +129,16 @@ namespace OpenSim.Framework.Communications.Tests | |||
116 | { | 129 | { |
117 | TestHelper.InMethod(); | 130 | TestHelper.InMethod(); |
118 | 131 | ||
119 | Scene myScene = SceneSetupHelpers.SetupScene(); | 132 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
120 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 133 | |
121 | for (int i = 0 ; i < 50 ; i++) | 134 | timedOut = true; |
122 | { | 135 | lock (this) |
123 | if (userInfo.HasReceivedInventory == true) | 136 | { |
124 | break; | 137 | UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
125 | Thread.Sleep(200); | 138 | Monitor.Wait(this, 60000); |
126 | } | 139 | } |
127 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | 140 | |
141 | Assert.That(timedOut, Is.False, "Timed out"); | ||
128 | } | 142 | } |
129 | 143 | ||
130 | [Test] | 144 | [Test] |
@@ -132,15 +146,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
132 | { | 146 | { |
133 | TestHelper.InMethod(); | 147 | TestHelper.InMethod(); |
134 | 148 | ||
135 | Scene myScene = SceneSetupHelpers.SetupScene(); | 149 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
136 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 150 | CachedUserInfo userInfo; |
137 | for (int i = 0 ; i < 50 ; i++) | 151 | |
138 | { | 152 | lock (this) |
139 | if (userInfo.HasReceivedInventory == true) | 153 | { |
140 | break; | 154 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
141 | Thread.Sleep(200); | 155 | Monitor.Wait(this, 60000); |
142 | } | 156 | } |
143 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
144 | 157 | ||
145 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | 158 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); |
146 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); | 159 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); |
@@ -154,15 +167,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
154 | { | 167 | { |
155 | TestHelper.InMethod(); | 168 | TestHelper.InMethod(); |
156 | 169 | ||
157 | Scene myScene = SceneSetupHelpers.SetupScene(); | 170 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
158 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 171 | CachedUserInfo userInfo; |
159 | for (int i = 0 ; i < 50 ; i++) | 172 | |
160 | { | 173 | lock (this) |
161 | if (userInfo.HasReceivedInventory == true) | 174 | { |
162 | break; | 175 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
163 | Thread.Sleep(200); | 176 | Monitor.Wait(this, 60000); |
164 | } | 177 | } |
165 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
166 | 178 | ||
167 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); | 179 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); |
168 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); | 180 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); |
@@ -190,15 +202,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
190 | { | 202 | { |
191 | TestHelper.InMethod(); | 203 | TestHelper.InMethod(); |
192 | 204 | ||
193 | Scene myScene = SceneSetupHelpers.SetupScene(); | 205 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
194 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 206 | CachedUserInfo userInfo; |
195 | for (int i = 0 ; i < 50 ; i++) | 207 | |
196 | { | 208 | lock (this) |
197 | if (userInfo.HasReceivedInventory == true) | 209 | { |
198 | break; | 210 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
199 | Thread.Sleep(200); | 211 | Monitor.Wait(this, 60000); |
200 | } | 212 | } |
201 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
202 | 213 | ||
203 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 214 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
204 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 215 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -256,15 +267,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
256 | { | 267 | { |
257 | TestHelper.InMethod(); | 268 | TestHelper.InMethod(); |
258 | 269 | ||
259 | Scene myScene = SceneSetupHelpers.SetupScene(); | 270 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
260 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 271 | CachedUserInfo userInfo; |
261 | for (int i = 0 ; i < 50 ; i++) | 272 | |
262 | { | 273 | lock (this) |
263 | if (userInfo.HasReceivedInventory == true) | 274 | { |
264 | break; | 275 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
265 | Thread.Sleep(200); | 276 | Monitor.Wait(this, 60000); |
266 | } | 277 | } |
267 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
268 | 278 | ||
269 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 279 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
270 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); | 280 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); |
@@ -297,15 +307,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
297 | TestHelper.InMethod(); | 307 | TestHelper.InMethod(); |
298 | //log4net.Config.XmlConfigurator.Configure(); | 308 | //log4net.Config.XmlConfigurator.Configure(); |
299 | 309 | ||
300 | Scene myScene = SceneSetupHelpers.SetupScene(); | 310 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
301 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 311 | CachedUserInfo userInfo; |
302 | for (int i = 0 ; i < 50 ; i++) | 312 | |
303 | { | 313 | lock (this) |
304 | if (userInfo.HasReceivedInventory == true) | 314 | { |
305 | break; | 315 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
306 | Thread.Sleep(200); | 316 | Monitor.Wait(this, 60000); |
307 | } | 317 | } |
308 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
309 | 318 | ||
310 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); | 319 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); |
311 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 320 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -322,4 +331,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
322 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); | 331 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); |
323 | } | 332 | } |
324 | } | 333 | } |
325 | } | 334 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 17a3393..b1b7809 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -36,6 +36,7 @@ using Nwc.XmlRpc; | |||
36 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
37 | using OpenSim.Framework.Communications.Services; | 37 | using OpenSim.Framework.Communications.Services; |
38 | using OpenSim.Region.Communications.Local; | 38 | using OpenSim.Region.Communications.Local; |
39 | using OpenSim.Tests.Common.Setup; | ||
39 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
40 | using OpenSim.Client.Linden; | 41 | using OpenSim.Client.Linden; |
41 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
@@ -57,11 +58,12 @@ namespace OpenSim.Framework.Communications.Tests | |||
57 | private string m_regionExternalName = "localhost"; | 58 | private string m_regionExternalName = "localhost"; |
58 | 59 | ||
59 | private IPEndPoint m_capsEndPoint; | 60 | private IPEndPoint m_capsEndPoint; |
60 | private CommunicationsManager m_commsManager; | 61 | private TestCommunicationsManager m_commsManager; |
61 | private TestLoginToRegionConnector m_regionConnector; | 62 | private TestLoginToRegionConnector m_regionConnector; |
62 | private LocalUserServices m_localUserServices; | 63 | private LocalUserServices m_localUserServices; |
63 | private LoginService m_loginService; | 64 | private LoginService m_loginService; |
64 | private UserProfileData m_userProfileData; | 65 | private UserProfileData m_userProfileData; |
66 | private TestScene m_testScene; | ||
65 | 67 | ||
66 | [SetUp] | 68 | [SetUp] |
67 | public void SetUpLoginEnviroment() | 69 | public void SetUpLoginEnviroment() |
@@ -69,13 +71,16 @@ namespace OpenSim.Framework.Communications.Tests | |||
69 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); | 71 | m_capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); |
70 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | 72 | m_commsManager = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); |
71 | m_regionConnector = new TestLoginToRegionConnector(); | 73 | m_regionConnector = new TestLoginToRegionConnector(); |
74 | m_testScene = SceneSetupHelpers.SetupScene(m_commsManager, ""); | ||
72 | 75 | ||
73 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); | 76 | m_regionConnector.AddRegion(new RegionInfo(42, 43, m_capsEndPoint, m_regionExternalName)); |
74 | 77 | ||
78 | //IInventoryService m_inventoryService = new TestInventoryService(); | ||
79 | |||
75 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; | 80 | m_localUserServices = (LocalUserServices) m_commsManager.UserService; |
76 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); | 81 | m_localUserServices.AddUser(m_firstName,m_lastName,"boingboing","abc@ftw.com",42,43); |
77 | 82 | ||
78 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", new TestInventoryService(), | 83 | m_loginService = new LLStandaloneLoginService((UserManagerBase) m_localUserServices, "Hello folks", m_testScene.InventoryService, |
79 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); | 84 | m_commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), m_regionConnector); |
80 | 85 | ||
81 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); | 86 | m_userProfileData = m_localUserServices.GetUserProfile(m_firstName, m_lastName); |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 58174a0..7ad6bbf 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -698,7 +698,7 @@ namespace OpenSim.Framework.Communications | |||
698 | if (rootfolder != null) | 698 | if (rootfolder != null) |
699 | userProf.RootInventoryFolderID = rootfolder.ID; | 699 | userProf.RootInventoryFolderID = rootfolder.ID; |
700 | } | 700 | } |
701 | else if (m_commsManager.InterServiceInventoryService != null) | 701 | else |
702 | { | 702 | { |
703 | // used by the user server | 703 | // used by the user server |
704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); | 704 | m_log.Debug("[USERSTORAGE]: using m_commsManager.InterServiceInventoryService to create user's inventory"); |