diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-11 20:32:05 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-11 20:32:05 -0400 |
commit | 2e9fc9a22b9718bb96934ed3b51ac0767f9ca4f3 (patch) | |
tree | b8a0cc747dd73da553d8d3504d3c842d9283be73 /OpenSim/Framework/Communications/Tests | |
parent | Try something to help the tests complete. (diff) | |
parent | Fixes a race condition in EQ processing that was making EQs pop up again upon... (diff) | |
download | opensim-SC-2e9fc9a22b9718bb96934ed3b51ac0767f9ca4f3.zip opensim-SC-2e9fc9a22b9718bb96934ed3b51ac0767f9ca4f3.tar.gz opensim-SC-2e9fc9a22b9718bb96934ed3b51ac0767f9ca4f3.tar.bz2 opensim-SC-2e9fc9a22b9718bb96934ed3b51ac0767f9ca4f3.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/Communications/Tests')
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | 96 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 129 |
2 files changed, 181 insertions, 44 deletions
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 0402883..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 | { |
@@ -118,14 +130,15 @@ namespace OpenSim.Framework.Communications.Tests | |||
118 | TestHelper.InMethod(); | 130 | TestHelper.InMethod(); |
119 | 131 | ||
120 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 132 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
121 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 133 | |
122 | for (int i = 0 ; i < 50 ; i++) | 134 | timedOut = true; |
123 | { | 135 | lock (this) |
124 | if (userInfo.HasReceivedInventory == true) | 136 | { |
125 | break; | 137 | UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
126 | Thread.Sleep(200); | 138 | Monitor.Wait(this, 60000); |
127 | } | 139 | } |
128 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | 140 | |
141 | Assert.That(timedOut, Is.False, "Timed out"); | ||
129 | } | 142 | } |
130 | 143 | ||
131 | [Test] | 144 | [Test] |
@@ -134,14 +147,13 @@ namespace OpenSim.Framework.Communications.Tests | |||
134 | TestHelper.InMethod(); | 147 | TestHelper.InMethod(); |
135 | 148 | ||
136 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 149 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
137 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 150 | CachedUserInfo userInfo; |
138 | for (int i = 0 ; i < 50 ; i++) | 151 | |
139 | { | 152 | lock (this) |
140 | if (userInfo.HasReceivedInventory == true) | 153 | { |
141 | break; | 154 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
142 | Thread.Sleep(200); | 155 | Monitor.Wait(this, 60000); |
143 | } | 156 | } |
144 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
145 | 157 | ||
146 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); | 158 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000011"); |
147 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); | 159 | Assert.That(userInfo.RootFolder.GetChildFolder(folderId), Is.Null); |
@@ -156,14 +168,13 @@ namespace OpenSim.Framework.Communications.Tests | |||
156 | TestHelper.InMethod(); | 168 | TestHelper.InMethod(); |
157 | 169 | ||
158 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 170 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
159 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 171 | CachedUserInfo userInfo; |
160 | for (int i = 0 ; i < 50 ; i++) | 172 | |
161 | { | 173 | lock (this) |
162 | if (userInfo.HasReceivedInventory == true) | 174 | { |
163 | break; | 175 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
164 | Thread.Sleep(200); | 176 | Monitor.Wait(this, 60000); |
165 | } | 177 | } |
166 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
167 | 178 | ||
168 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); | 179 | UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); |
169 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); | 180 | Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); |
@@ -192,14 +203,13 @@ namespace OpenSim.Framework.Communications.Tests | |||
192 | TestHelper.InMethod(); | 203 | TestHelper.InMethod(); |
193 | 204 | ||
194 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 205 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
195 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 206 | CachedUserInfo userInfo; |
196 | for (int i = 0 ; i < 50 ; i++) | 207 | |
197 | { | 208 | lock (this) |
198 | if (userInfo.HasReceivedInventory == true) | 209 | { |
199 | break; | 210 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
200 | Thread.Sleep(200); | 211 | Monitor.Wait(this, 60000); |
201 | } | 212 | } |
202 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
203 | 213 | ||
204 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); | 214 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); |
205 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 215 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -258,14 +268,13 @@ namespace OpenSim.Framework.Communications.Tests | |||
258 | TestHelper.InMethod(); | 268 | TestHelper.InMethod(); |
259 | 269 | ||
260 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 270 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
261 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 271 | CachedUserInfo userInfo; |
262 | for (int i = 0 ; i < 50 ; i++) | 272 | |
263 | { | 273 | lock (this) |
264 | if (userInfo.HasReceivedInventory == true) | 274 | { |
265 | break; | 275 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
266 | Thread.Sleep(200); | 276 | Monitor.Wait(this, 60000); |
267 | } | 277 | } |
268 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
269 | 278 | ||
270 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); | 279 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000020"); |
271 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); | 280 | UUID folder2Id = UUID.Parse("00000000-0000-0000-0000-000000000021"); |
@@ -299,14 +308,13 @@ namespace OpenSim.Framework.Communications.Tests | |||
299 | //log4net.Config.XmlConfigurator.Configure(); | 308 | //log4net.Config.XmlConfigurator.Configure(); |
300 | 309 | ||
301 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); | 310 | Scene myScene = SceneSetupHelpers.SetupScene("inventory"); |
302 | CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager); | 311 | CachedUserInfo userInfo; |
303 | for (int i = 0 ; i < 50 ; i++) | 312 | |
304 | { | 313 | lock (this) |
305 | if (userInfo.HasReceivedInventory == true) | 314 | { |
306 | break; | 315 | userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived); |
307 | Thread.Sleep(200); | 316 | Monitor.Wait(this, 60000); |
308 | } | 317 | } |
309 | Assert.That(userInfo.HasReceivedInventory, Is.True, "FetchInventory timed out (10 seconds)"); | ||
310 | 318 | ||
311 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); | 319 | UUID folder1Id = UUID.Parse("00000000-0000-0000-0000-000000000070"); |
312 | InventoryFolderImpl rootFolder = userInfo.RootFolder; | 320 | InventoryFolderImpl rootFolder = userInfo.RootFolder; |
@@ -323,4 +331,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
323 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); | 331 | Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null); |
324 | } | 332 | } |
325 | } | 333 | } |
326 | } | 334 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 9e181f3..b1b7809 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -447,4 +447,133 @@ namespace OpenSim.Framework.Communications.Tests | |||
447 | #endregion | 447 | #endregion |
448 | } | 448 | } |
449 | } | 449 | } |
450 | |||
451 | class TestInventoryService : IInventoryService | ||
452 | { | ||
453 | public TestInventoryService() | ||
454 | { | ||
455 | } | ||
456 | |||
457 | /// <summary> | ||
458 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
459 | /// </summary> | ||
460 | /// <param name="userId"></param> | ||
461 | /// <returns></returns> | ||
462 | public bool CreateUserInventory(UUID userId) | ||
463 | { | ||
464 | return false; | ||
465 | } | ||
466 | |||
467 | /// <summary> | ||
468 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
469 | /// </summary> | ||
470 | /// <param name="userId"></param> | ||
471 | /// <returns></returns> | ||
472 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
473 | { | ||
474 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
475 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
476 | folder.ID = UUID.Random(); | ||
477 | folder.Owner = userId; | ||
478 | folders.Add(folder); | ||
479 | return folders; | ||
480 | } | ||
481 | |||
482 | /// <summary> | ||
483 | /// Returns a list of all the active gestures in a user's inventory. | ||
484 | /// </summary> | ||
485 | /// <param name="userId"> | ||
486 | /// The <see cref="UUID"/> of the user | ||
487 | /// </param> | ||
488 | /// <returns> | ||
489 | /// A flat list of the gesture items. | ||
490 | /// </returns> | ||
491 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
492 | { | ||
493 | return null; | ||
494 | } | ||
495 | |||
496 | public InventoryCollection GetUserInventory(UUID userID) | ||
497 | { | ||
498 | return null; | ||
499 | } | ||
500 | |||
501 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
502 | { | ||
503 | } | ||
504 | |||
505 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
506 | { | ||
507 | return null; | ||
508 | } | ||
509 | |||
510 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
511 | { | ||
512 | return null; | ||
513 | } | ||
514 | |||
515 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
516 | { | ||
517 | return null; | ||
518 | } | ||
519 | |||
520 | public bool AddFolder(InventoryFolderBase folder) | ||
521 | { | ||
522 | return false; | ||
523 | } | ||
524 | |||
525 | public bool UpdateFolder(InventoryFolderBase folder) | ||
526 | { | ||
527 | return false; | ||
528 | } | ||
529 | |||
530 | public bool MoveFolder(InventoryFolderBase folder) | ||
531 | { | ||
532 | return false; | ||
533 | } | ||
534 | |||
535 | public bool PurgeFolder(InventoryFolderBase folder) | ||
536 | { | ||
537 | return false; | ||
538 | } | ||
539 | |||
540 | public bool AddItem(InventoryItemBase item) | ||
541 | { | ||
542 | return false; | ||
543 | } | ||
544 | |||
545 | public bool UpdateItem(InventoryItemBase item) | ||
546 | { | ||
547 | return false; | ||
548 | } | ||
549 | |||
550 | public bool DeleteItem(InventoryItemBase item) | ||
551 | { | ||
552 | return false; | ||
553 | } | ||
554 | |||
555 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
556 | { | ||
557 | return null; | ||
558 | } | ||
559 | |||
560 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
561 | { | ||
562 | return null; | ||
563 | } | ||
564 | |||
565 | public bool HasInventoryForUser(UUID userID) | ||
566 | { | ||
567 | return false; | ||
568 | } | ||
569 | |||
570 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
571 | { | ||
572 | InventoryFolderBase root = new InventoryFolderBase(); | ||
573 | root.ID = UUID.Random(); | ||
574 | root.Owner = userID; | ||
575 | root.ParentID = UUID.Zero; | ||
576 | return root; | ||
577 | } | ||
578 | } | ||
450 | } | 579 | } |