diff options
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 130 |
2 files changed, 115 insertions, 18 deletions
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 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework.Communications.Cache; | 31 | using OpenSim.Framework.Communications.Cache; |
@@ -111,6 +112,7 @@ namespace OpenSim.Framework.Communications | |||
111 | } | 112 | } |
112 | protected BaseHttpServer m_httpServer; | 113 | protected BaseHttpServer m_httpServer; |
113 | 114 | ||
115 | |||
114 | /// <summary> | 116 | /// <summary> |
115 | /// Constructor | 117 | /// Constructor |
116 | /// </summary> | 118 | /// </summary> |
@@ -125,7 +127,6 @@ namespace OpenSim.Framework.Communications | |||
125 | m_assetCache = assetCache; | 127 | m_assetCache = assetCache; |
126 | m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder); | 128 | m_userProfileCacheService = new UserProfileCacheService(this, libraryRootFolder); |
127 | m_httpServer = httpServer; | 129 | m_httpServer = httpServer; |
128 | // m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile); | ||
129 | } | 130 | } |
130 | 131 | ||
131 | #region Inventory | 132 | #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 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Net; | 31 | using System.Net; |
31 | using System.Text.RegularExpressions; | 32 | using System.Text.RegularExpressions; |
32 | using NUnit.Framework; | 33 | using NUnit.Framework; |
@@ -35,6 +36,7 @@ using Nwc.XmlRpc; | |||
35 | using OpenSim.Framework.Communications.Cache; | 36 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Communications.Local; | 37 | using OpenSim.Region.Communications.Local; |
37 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
39 | using OpenSim.Client.Linden; | ||
38 | 40 | ||
39 | namespace OpenSim.Framework.Communications.Tests | 41 | namespace OpenSim.Framework.Communications.Tests |
40 | { | 42 | { |
@@ -60,16 +62,22 @@ namespace OpenSim.Framework.Communications.Tests | |||
60 | 62 | ||
61 | CommunicationsManager commsManager | 63 | CommunicationsManager commsManager |
62 | = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | 64 | = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); |
65 | |||
66 | //commsManager.GridService.RegisterRegion( | ||
67 | // new RegionInfo(42, 43, capsEndPoint, regionExternalName)); | ||
68 | //commsManager.GridService.RegionLoginsEnabled = true; | ||
63 | 69 | ||
64 | commsManager.GridService.RegisterRegion( | 70 | //LoginService loginService |
65 | new RegionInfo(42, 43, capsEndPoint, regionExternalName)); | 71 | // = new LocalLoginService( |
66 | commsManager.GridService.RegionLoginsEnabled = true; | 72 | // (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService, |
73 | // (LocalBackEndServices)commsManager.GridService, | ||
74 | // commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty)); | ||
67 | 75 | ||
68 | LoginService loginService | 76 | TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector(); |
69 | = new LocalLoginService( | 77 | regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName)); |
70 | (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService, | 78 | |
71 | (LocalBackEndServices)commsManager.GridService, | 79 | LoginService loginService = new LLStandaloneLoginService((UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService, |
72 | commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty)); | 80 | commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty), regionConnector); |
73 | 81 | ||
74 | Hashtable loginParams = new Hashtable(); | 82 | Hashtable loginParams = new Hashtable(); |
75 | loginParams["first"] = firstName; | 83 | loginParams["first"] = firstName; |
@@ -108,21 +116,25 @@ namespace OpenSim.Framework.Communications.Tests | |||
108 | CommunicationsManager commsManager | 116 | CommunicationsManager commsManager |
109 | = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); | 117 | = new TestCommunicationsManager(new NetworkServersInfo(42, 43)); |
110 | 118 | ||
111 | commsManager.GridService.RegisterRegion( | ||
112 | new RegionInfo(42, 43, capsEndPoint, regionExternalName)); | ||
113 | commsManager.GridService.RegionLoginsEnabled = true; | ||
114 | |||
115 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | 119 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; |
116 | 120 | ||
117 | lus.AddUser(firstName,lastName,"boingboing","abc@ftw.com",42,43); | 121 | lus.AddUser(firstName,lastName,"boingboing","abc@ftw.com",42,43); |
118 | 122 | ||
123 | //commsManager.GridService.RegisterRegion( | ||
124 | // new RegionInfo(42, 43, capsEndPoint, regionExternalName)); | ||
125 | //commsManager.GridService.RegionLoginsEnabled = true; | ||
119 | 126 | ||
120 | LoginService loginService | 127 | //LoginService loginService |
121 | = new LocalLoginService( | 128 | // = new LocalLoginService( |
122 | (UserManagerBase)lus, "Hello folks", commsManager.InterServiceInventoryService, | 129 | // (UserManagerBase)lus, "Hello folks", commsManager.InterServiceInventoryService, |
123 | (LocalBackEndServices)commsManager.GridService, | 130 | // (LocalBackEndServices)commsManager.GridService, |
124 | commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty)); | 131 | // commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty)); |
125 | 132 | ||
133 | TestLoginToRegionConnector regionConnector = new TestLoginToRegionConnector(); | ||
134 | regionConnector.AddRegion(new RegionInfo(42, 43, capsEndPoint, regionExternalName)); | ||
135 | |||
136 | LoginService loginService = new LLStandaloneLoginService((UserManagerBase) lus, "Hello folks", commsManager.InterServiceInventoryService, | ||
137 | commsManager.NetworkServersInfo, true, new LibraryRootFolder(String.Empty), regionConnector); | ||
126 | 138 | ||
127 | // TODO: Not check inventory part of response yet. | 139 | // TODO: Not check inventory part of response yet. |
128 | // TODO: Not checking all of login response thoroughly yet. | 140 | // TODO: Not checking all of login response thoroughly yet. |
@@ -277,5 +289,89 @@ namespace OpenSim.Framework.Communications.Tests | |||
277 | responseData = (Hashtable)response.Value; | 289 | responseData = (Hashtable)response.Value; |
278 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); | 290 | Assert.That(responseData["message"], Is.EqualTo("Hello folks")); |
279 | } | 291 | } |
292 | |||
293 | public class TestLoginToRegionConnector : ILoginRegionsConnector | ||
294 | { | ||
295 | |||
296 | private List<RegionInfo> m_regionsList = new List<RegionInfo>(); | ||
297 | |||
298 | public void AddRegion(RegionInfo regionInfo) | ||
299 | { | ||
300 | lock (m_regionsList) | ||
301 | { | ||
302 | if (!m_regionsList.Contains(regionInfo)) | ||
303 | { | ||
304 | m_regionsList.Add(regionInfo); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | |||
309 | #region ILoginRegionsConnector Members | ||
310 | public bool RegionLoginsEnabled | ||
311 | { | ||
312 | get { return true; } | ||
313 | } | ||
314 | |||
315 | public void LogOffUserFromGrid(ulong regionHandle, OpenMetaverse.UUID AvatarID, OpenMetaverse.UUID RegionSecret, string message) | ||
316 | { | ||
317 | } | ||
318 | |||
319 | public bool NewUserConnection(ulong regionHandle, AgentCircuitData agent) | ||
320 | { | ||
321 | lock (m_regionsList) | ||
322 | { | ||
323 | foreach (RegionInfo regInfo in m_regionsList) | ||
324 | { | ||
325 | if (regInfo.RegionHandle == regionHandle) | ||
326 | return true; | ||
327 | } | ||
328 | } | ||
329 | return false; | ||
330 | } | ||
331 | |||
332 | public RegionInfo RequestClosestRegion(string region) | ||
333 | { | ||
334 | lock (m_regionsList) | ||
335 | { | ||
336 | foreach (RegionInfo regInfo in m_regionsList) | ||
337 | { | ||
338 | if (regInfo.RegionName == region) | ||
339 | return regInfo; | ||
340 | } | ||
341 | } | ||
342 | |||
343 | return null; | ||
344 | } | ||
345 | |||
346 | public RegionInfo RequestNeighbourInfo(OpenMetaverse.UUID regionID) | ||
347 | { | ||
348 | lock (m_regionsList) | ||
349 | { | ||
350 | foreach (RegionInfo regInfo in m_regionsList) | ||
351 | { | ||
352 | if (regInfo.RegionID == regionID) | ||
353 | return regInfo; | ||
354 | } | ||
355 | } | ||
356 | |||
357 | return null; | ||
358 | } | ||
359 | |||
360 | public RegionInfo RequestNeighbourInfo(ulong regionHandle) | ||
361 | { | ||
362 | lock (m_regionsList) | ||
363 | { | ||
364 | foreach (RegionInfo regInfo in m_regionsList) | ||
365 | { | ||
366 | if (regInfo.RegionHandle == regionHandle) | ||
367 | return regInfo; | ||
368 | } | ||
369 | } | ||
370 | |||
371 | return null; | ||
372 | } | ||
373 | |||
374 | #endregion | ||
375 | } | ||
280 | } | 376 | } |
281 | } | 377 | } |