From 171015f65fc2226b92b0f881a49e0110445e5045 Mon Sep 17 00:00:00 2001
From: MW
Date: Tue, 3 Mar 2009 15:41:21 +0000
Subject: Moved Linden protocol login handling to modules in
OpenSim.Client.Linden. There are two region modules in there
LLStandaloneLoginModule (for standalone mode) and LLProxyLoginModule (for
grid mode which just handles incoming expect_user and logoff_user messages
from the remote login server) Changed
OpenSim.Framework.Communications.Tests.LoginServiceTests to use the
LLStandaloneLoginService (from the LLStandaloneLoginModule) rather than
LocalLoginService. Really these login tests should most likely be somewhere
else as they are testing specific implementations of login services.
Commented out the old LocalLoginService as its no longer used, but want to
check there are no problems before it gets deleted.
---
.../Communications/CommunicationsManager.cs | 3 +-
.../Communications/Tests/LoginServiceTests.cs | 130 ++++++++++++++++++---
2 files changed, 115 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index bb8e452..3363c24 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework.Communications.Cache;
@@ -111,6 +112,7 @@ namespace OpenSim.Framework.Communications
}
protected BaseHttpServer m_httpServer;
+
///
/// Constructor
///
@@ -125,7 +127,6 @@ namespace OpenSim.Framework.Communications
m_assetCache = assetCache;
m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder);
m_httpServer = httpServer;
- // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
}
#region Inventory
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index 57ed0f5..854d68d 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections;
+using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using NUnit.Framework;
@@ -35,6 +36,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Communications.Local;
using OpenSim.Tests.Common.Mock;
+using OpenSim.Client.Linden;
namespace OpenSim.Framework.Communications.Tests
{
@@ -60,16 +62,22 @@ namespace OpenSim.Framework.Communications.Tests
CommunicationsManager commsManager
= new TestCommunicationsManager(new NetworkServersInfo(42, 43));
+
+ //commsManager.GridService.RegisterRegion(
+ // new RegionInfo(42, 43, capsEndPoint, regionExternalName));
+ //commsManager.GridService.RegionLoginsEnabled = true;
- commsManager.GridService.RegisterRegion(
- new RegionInfo(42, 43, capsEndPoint, regionExternalName));
- commsManager.GridService.RegionLoginsEnabled = true;
+ //LoginService loginService
+ // = new LocalLoginService(
+ // (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService,
+ // (LocalBackEndServices)commsManager.GridService,
+ // commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty));
- LoginService loginService
- = new LocalLoginService(
- (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService,
- (LocalBackEndServices)commsManager.GridService,
- commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty));
+ TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector();
+ regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName));
+
+ LoginService loginService = new LLStandaloneLoginService((UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService,
+ commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), regionConnector);
Hashtable loginParams = new Hashtable();
loginParams["first"] = firstName;
@@ -108,21 +116,25 @@ namespace OpenSim.Framework.Communications.Tests
CommunicationsManager commsManager
= new TestCommunicationsManager(new NetworkServersInfo(42, 43));
- commsManager.GridService.RegisterRegion(
- new RegionInfo(42, 43, capsEndPoint, regionExternalName));
- commsManager.GridService.RegionLoginsEnabled = true;
-
LocalUserServices lus = (LocalUserServices)commsManager.UserService;
lus.AddUser(firstName,lastName,"boingboing","abc@ftw.com",42,43);
+ //commsManager.GridService.RegisterRegion(
+ // new RegionInfo(42, 43, capsEndPoint, regionExternalName));
+ //commsManager.GridService.RegionLoginsEnabled = true;
- LoginService loginService
- = new LocalLoginService(
- (UserManagerBase)lus, "Hello folks", commsManager.InterServiceInventoryService,
- (LocalBackEndServices)commsManager.GridService,
- commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty));
+ //LoginService loginService
+ // = new LocalLoginService(
+ // (UserManagerBase)lus, "Hello folks", commsManager.InterServiceInventoryService,
+ // (LocalBackEndServices)commsManager.GridService,
+ // commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty));
+ TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector();
+ regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName));
+
+ LoginService loginService = new LLStandaloneLoginService((UserManagerBase) lus, "Hello folks", commsManager.InterServiceInventoryService,
+ commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), regionConnector);
// TODO: Not check inventory part of response yet.
// TODO: Not checking all of login response thoroughly yet.
@@ -277,5 +289,89 @@ namespace OpenSim.Framework.Communications.Tests
responseData = (Hashtable)response.Value;
Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
}
+
+ public class TestLoginToRegionConnector : ILoginRegionsConnector
+ {
+
+ private List m_regionsList = new List();
+
+ public void AddRegion(RegionInfo regionInfo)
+ {
+ lock (m_regionsList)
+ {
+ if (!m_regionsList.Contains(regionInfo))
+ {
+ m_regionsList.Add(regionInfo);
+ }
+ }
+ }
+
+ #region ILoginRegionsConnector Members
+ public bool RegionLoginsEnabled
+ {
+ get { return true; }
+ }
+
+ public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message)
+ {
+ }
+
+ public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent)
+ {
+ lock (m_regionsList)
+ {
+ foreach (RegionInfo regInfo in m_regionsList)
+ {
+ if (regInfo.RegionHandle == regionHandle)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public RegionInfo RequestClosestRegion(string region)
+ {
+ lock (m_regionsList)
+ {
+ foreach (RegionInfo regInfo in m_regionsList)
+ {
+ if (regInfo.RegionName == region)
+ return regInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public RegionInfo RequestNeighbourInfo(OpenMetaverse.UUID regionID)
+ {
+ lock (m_regionsList)
+ {
+ foreach (RegionInfo regInfo in m_regionsList)
+ {
+ if (regInfo.RegionID == regionID)
+ return regInfo;
+ }
+ }
+
+ return null;
+ }
+
+ public RegionInfo RequestNeighbourInfo(ulong regionHandle)
+ {
+ lock (m_regionsList)
+ {
+ foreach (RegionInfo regInfo in m_regionsList)
+ {
+ if (regInfo.RegionHandle == regionHandle)
+ return regInfo;
+ }
+ }
+
+ return null;
+ }
+
+ #endregion
+ }
}
}
--
cgit v1.1