aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
diff options
context:
space:
mode:
authorMW2009-03-03 15:41:21 +0000
committerMW2009-03-03 15:41:21 +0000
commit171015f65fc2226b92b0f881a49e0110445e5045 (patch)
treee4d1dcbb4739cc61057dd3d89dc278ed67e56c29 /OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
parentRefactoring of CreateCommsManagerPlugin. (diff)
downloadopensim-SC_OLD-171015f65fc2226b92b0f881a49e0110445e5045.zip
opensim-SC_OLD-171015f65fc2226b92b0f881a49e0110445e5045.tar.gz
opensim-SC_OLD-171015f65fc2226b92b0f881a49e0110445e5045.tar.bz2
opensim-SC_OLD-171015f65fc2226b92b0f881a49e0110445e5045.tar.xz
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.
Diffstat (limited to 'OpenSim/Framework/Communications/Tests/LoginServiceTests.cs')
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs130
1 files changed, 113 insertions, 17 deletions
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
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Text.RegularExpressions; 32using System.Text.RegularExpressions;
32using NUnit.Framework; 33using NUnit.Framework;
@@ -35,6 +36,7 @@ using Nwc.XmlRpc;
35using OpenSim.Framework.Communications.Cache; 36using OpenSim.Framework.Communications.Cache;
36using OpenSim.Region.Communications.Local; 37using OpenSim.Region.Communications.Local;
37using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
39using OpenSim.Client.Linden;
38 40
39namespace OpenSim.Framework.Communications.Tests 41namespace 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}