diff options
author | Arthur Valadares | 2009-08-11 12:07:54 -0300 |
---|---|---|
committer | Arthur Valadares | 2009-08-11 12:07:54 -0300 |
commit | 18aa2ea0c5ebd8d5131902ed9856e68f46e76e11 (patch) | |
tree | c4adcda365c46052c3d15b4e6395e1bb8a2e97c5 /OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |
parent | Replace the Replaceable modules name (diff) | |
download | opensim-SC-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.zip opensim-SC-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.gz opensim-SC-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.bz2 opensim-SC-18aa2ea0c5ebd8d5131902ed9856e68f46e76e11.tar.xz |
* Improves SceneSetupHelper to allow the tester to choose a real or mock, inventory and asset, service modules. The boolean startServices was replaced with realServices string. If the string contains the word asset, it will start a real asset module, if it contains inventory, it starts a real inventory. Otherwise, it use mock (NullPlugin-like) objects, for tests that don't really need functionality.
* SetupScene is now actually sharing the asset and inventory modules if the tester wishes to have multiple regions connected. To link regions, just start SetupScene with the same CommunicationManager for all scenes. SceneSetupHelper will hold a static reference to the modules and won't initialize them again, just run the scenes through the modules AddRegion, RegionLoaded and PostInitialize.
* With the recent changes, both asset and inventory (and in the future, user) services should always be asked from the scene, not instantiated alone. The tests should reflect this new behavior and always start a scene.
Diffstat (limited to 'OpenSim/Framework/Communications/Tests/LoginServiceTests.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 128 |
1 files changed, 7 insertions, 121 deletions
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 47e0293..9e181f3 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); |
@@ -442,123 +447,4 @@ namespace OpenSim.Framework.Communications.Tests | |||
442 | #endregion | 447 | #endregion |
443 | } | 448 | } |
444 | } | 449 | } |
445 | |||
446 | class TestInventoryService : IInventoryService | ||
447 | { | ||
448 | public TestInventoryService() | ||
449 | { | ||
450 | } | ||
451 | |||
452 | /// <summary> | ||
453 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
454 | /// </summary> | ||
455 | /// <param name="userId"></param> | ||
456 | /// <returns></returns> | ||
457 | public bool CreateUserInventory(UUID userId) | ||
458 | { | ||
459 | return false; | ||
460 | } | ||
461 | |||
462 | /// <summary> | ||
463 | /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> | ||
464 | /// </summary> | ||
465 | /// <param name="userId"></param> | ||
466 | /// <returns></returns> | ||
467 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
468 | { | ||
469 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | ||
470 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
471 | folder.ID = UUID.Random(); | ||
472 | folder.Owner = userId; | ||
473 | folders.Add(folder); | ||
474 | return folders; | ||
475 | } | ||
476 | |||
477 | /// <summary> | ||
478 | /// Returns a list of all the active gestures in a user's inventory. | ||
479 | /// </summary> | ||
480 | /// <param name="userId"> | ||
481 | /// The <see cref="UUID"/> of the user | ||
482 | /// </param> | ||
483 | /// <returns> | ||
484 | /// A flat list of the gesture items. | ||
485 | /// </returns> | ||
486 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
487 | { | ||
488 | return null; | ||
489 | } | ||
490 | |||
491 | public InventoryCollection GetUserInventory(UUID userID) | ||
492 | { | ||
493 | return null; | ||
494 | } | ||
495 | |||
496 | public void GetUserInventory(UUID userID, OpenSim.Services.Interfaces.InventoryReceiptCallback callback) | ||
497 | { | ||
498 | } | ||
499 | |||
500 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
501 | { | ||
502 | return null; | ||
503 | } | ||
504 | |||
505 | public bool AddFolder(InventoryFolderBase folder) | ||
506 | { | ||
507 | return false; | ||
508 | } | ||
509 | |||
510 | public bool UpdateFolder(InventoryFolderBase folder) | ||
511 | { | ||
512 | return false; | ||
513 | } | ||
514 | |||
515 | public bool MoveFolder(InventoryFolderBase folder) | ||
516 | { | ||
517 | return false; | ||
518 | } | ||
519 | |||
520 | public bool PurgeFolder(InventoryFolderBase folder) | ||
521 | { | ||
522 | return false; | ||
523 | } | ||
524 | |||
525 | public bool AddItem(InventoryItemBase item) | ||
526 | { | ||
527 | return false; | ||
528 | } | ||
529 | |||
530 | public bool UpdateItem(InventoryItemBase item) | ||
531 | { | ||
532 | return false; | ||
533 | } | ||
534 | |||
535 | public bool DeleteItem(InventoryItemBase item) | ||
536 | { | ||
537 | return false; | ||
538 | } | ||
539 | |||
540 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
541 | { | ||
542 | return null; | ||
543 | } | ||
544 | |||
545 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
546 | { | ||
547 | return null; | ||
548 | } | ||
549 | |||
550 | public bool HasInventoryForUser(UUID userID) | ||
551 | { | ||
552 | return false; | ||
553 | } | ||
554 | |||
555 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
556 | { | ||
557 | InventoryFolderBase root = new InventoryFolderBase(); | ||
558 | root.ID = UUID.Random(); | ||
559 | root.Owner = userID; | ||
560 | root.ParentID = UUID.Zero; | ||
561 | return root; | ||
562 | } | ||
563 | } | ||
564 | } | 450 | } |