From 59157d9d63c0e038ca0a619bfae1be3ed6f77677 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 30 Mar 2012 00:40:19 +0100 Subject: Add simple login test with online friends. Add IFriendsModule.GrantRights() for granting rights via a module call. Rename IFriendsModule.GetFriendPerms() -> GetRightsGrantedByFriend() to be more self-documenting and consistent with friends module terminology. Add some method doc. --- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 12 +++++++--- OpenSim/Tests/Common/Mock/TestClient.cs | 36 ++++++++++++++++++---------- 2 files changed, 32 insertions(+), 16 deletions(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 7bf08ae..318758d 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -369,8 +369,11 @@ namespace OpenSim.Tests.Common agentData.AgentID = agentId; agentData.firstname = firstName; agentData.lastname = "testlastname"; - agentData.SessionID = UUID.Zero; - agentData.SecureSessionID = UUID.Zero; + + // XXX: Sessions must be unique, otherwise one presence can overwrite another in NullPresenceData. + agentData.SessionID = UUID.Random(); + agentData.SecureSessionID = UUID.Random(); + agentData.circuitcode = 123; agentData.BaseFolder = UUID.Zero; agentData.InventoryFolder = UUID.Zero; @@ -416,7 +419,10 @@ namespace OpenSim.Tests.Common // We emulate the proper login sequence here by doing things in four stages // Stage 0: login - scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); + // We need to punch through to the underlying service because scene will not, correctly, let us call it + // through it's reference to the LPSC + LocalPresenceServicesConnector lpsc = (LocalPresenceServicesConnector)scene.PresenceService; + lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); // Stages 1 & 2 ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin); diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index d6e7200..cb9840e 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -347,15 +347,9 @@ namespace OpenSim.Tests.Common.Mock get { return m_agentId; } } - public UUID SessionId - { - get { return UUID.Zero; } - } + public UUID SessionId { get; set; } - public UUID SecureSessionId - { - get { return UUID.Zero; } - } + public UUID SecureSessionId { get; set; } public virtual string FirstName { @@ -379,11 +373,9 @@ namespace OpenSim.Tests.Common.Mock get { return true; } set { } } - public bool IsLoggingOut - { - get { return false; } - set { } - } + + public bool IsLoggingOut { get; set; } + public UUID ActiveGroupId { get { return UUID.Zero; } @@ -449,6 +441,8 @@ namespace OpenSim.Tests.Common.Mock m_lastName = agentData.lastname; m_circuitCode = agentData.circuitcode; m_scene = scene; + SessionId = agentData.SessionID; + SecureSessionId = agentData.SecureSessionID; CapsSeedUrl = agentData.CapsPath; ReceivedOfflineNotifications = new List(); @@ -900,8 +894,24 @@ namespace OpenSim.Tests.Common.Mock { } + /// + /// This is a TestClient only method to do shutdown tasks that are normally carried out by LLUDPServer.RemoveClient() + /// + public void Logout() + { + // We must set this here so that the presence is removed from the PresenceService by the PresenceDetector + IsLoggingOut = true; + + Close(); + } + public void Close() { + // Fire the callback for this connection closing + // This is necesary to get the presence detector to notice that a client has logged out. + if (OnConnectionClosed != null) + OnConnectionClosed(this); + m_scene.RemoveClient(AgentId, true); } -- cgit v1.1