diff options
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | 96 | ||||
-rw-r--r-- | OpenSim/Grid/UserServer/UserLoginService.cs | 1 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | 5 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs | 5 | ||||
-rw-r--r-- | prebuild.xml | 1 |
6 files changed, 106 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index b2434c2..f34f10c 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -117,8 +117,6 @@ namespace OpenSim.Framework.Communications | |||
117 | 117 | ||
118 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && | 118 | bool GoodXML = (requestData.Contains("first") && requestData.Contains("last") && |
119 | (requestData.Contains("passwd") || requestData.Contains("web_login_key"))); | 119 | (requestData.Contains("passwd") || requestData.Contains("web_login_key"))); |
120 | |||
121 | //bool GoodLogin; | ||
122 | 120 | ||
123 | string startLocationRequest = "last"; | 121 | string startLocationRequest = "last"; |
124 | 122 | ||
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs new file mode 100644 index 0000000..51adba1 --- /dev/null +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.Net; | ||
31 | using NUnit.Framework; | ||
32 | using NUnit.Framework.SyntaxHelpers; | ||
33 | using Nwc.XmlRpc; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Communications.Local; | ||
36 | using OpenSim.Tests.Common.Mock; | ||
37 | |||
38 | namespace OpenSim.Framework.Communications.Tests | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Test the login service. For now, most of this will be done through the LocalLoginService as LoginService | ||
42 | /// is abstract | ||
43 | /// </summary> | ||
44 | [TestFixture] | ||
45 | public class LoginServiceTests | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// Test the normal response to a login. Does not test authentication. Doesn't yet do what it says on the tin. | ||
49 | /// </summary> | ||
50 | [Test] | ||
51 | public void TestNormalLoginResponse() | ||
52 | { | ||
53 | log4net.Config.XmlConfigurator.Configure(); | ||
54 | |||
55 | string firstName = "Timmy"; | ||
56 | string lastName = "Mallet"; | ||
57 | |||
58 | CommunicationsManager commsManager | ||
59 | = new TestCommunicationsManager(new OpenSim.Framework.NetworkServersInfo(42, 43)); | ||
60 | |||
61 | ((LocalUserServices)commsManager.UserService).AddPlugin(new TestUserDataPlugin()); | ||
62 | ((LocalInventoryService)commsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); | ||
63 | |||
64 | commsManager.GridService.RegisterRegion( | ||
65 | new RegionInfo(42, 43, new IPEndPoint(IPAddress.Loopback, 9000), "localhost")); | ||
66 | commsManager.GridService.RegionLoginsEnabled = true; | ||
67 | |||
68 | LoginService loginService | ||
69 | = new LocalLoginService( | ||
70 | (UserManagerBase)commsManager.UserService, "Hello folks", commsManager.InterServiceInventoryService, | ||
71 | (LocalBackEndServices)commsManager.GridService, | ||
72 | commsManager.NetworkServersInfo, false, new LibraryRootFolder(String.Empty)); | ||
73 | |||
74 | Hashtable loginParams = new Hashtable(); | ||
75 | loginParams["first"] = firstName; | ||
76 | loginParams["last"] = lastName; | ||
77 | loginParams["passwd"] = "boingboing"; | ||
78 | |||
79 | ArrayList sendParams = new ArrayList(); | ||
80 | sendParams.Add(loginParams); | ||
81 | |||
82 | XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); | ||
83 | |||
84 | XmlRpcResponse response = loginService.XmlRpcLoginMethod(request); | ||
85 | Hashtable responseData = (Hashtable)response.Value; | ||
86 | |||
87 | // TODO: Not check inventory part of response yet. | ||
88 | // TODO: Not checking all of login response thoroughly yet. | ||
89 | |||
90 | Assert.That( | ||
91 | responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(System.Int32.MaxValue)); | ||
92 | Assert.That(responseData["first_name"], Is.EqualTo(firstName)); | ||
93 | Assert.That(responseData["last_name"], Is.EqualTo(lastName)); | ||
94 | } | ||
95 | } | ||
96 | } | ||
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs index 1ba817d..4819337 100644 --- a/OpenSim/Grid/UserServer/UserLoginService.cs +++ b/OpenSim/Grid/UserServer/UserLoginService.cs | |||
@@ -320,6 +320,7 @@ namespace OpenSim.Grid.UserServer | |||
320 | // Update agent with target sim | 320 | // Update agent with target sim |
321 | user.CurrentAgent.Region = regionInfo.UUID; | 321 | user.CurrentAgent.Region = regionInfo.UUID; |
322 | user.CurrentAgent.Handle = regionInfo.regionHandle; | 322 | user.CurrentAgent.Handle = regionInfo.regionHandle; |
323 | |||
323 | // Prepare notification | 324 | // Prepare notification |
324 | Hashtable loginParams = new Hashtable(); | 325 | Hashtable loginParams = new Hashtable(); |
325 | loginParams["session_id"] = user.CurrentAgent.SessionID.ToString(); | 326 | loginParams["session_id"] = user.CurrentAgent.SessionID.ToString(); |
diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 472645c..204ebd7 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | |||
@@ -49,7 +49,10 @@ namespace OpenSim.Tests.Common.Mock | |||
49 | 49 | ||
50 | LocalUserServices lus = new LocalUserServices(991, 992, lis); | 50 | LocalUserServices lus = new LocalUserServices(991, 992, lis); |
51 | m_userService = lus; | 51 | m_userService = lus; |
52 | m_userAdminService = lus; | 52 | m_userAdminService = lus; |
53 | |||
54 | LocalBackEndServices gs = new LocalBackEndServices(); | ||
55 | m_gridService = gs; | ||
53 | } | 56 | } |
54 | } | 57 | } |
55 | } | 58 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs index a5e2a37..6be7b3d 100644 --- a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs | |||
@@ -102,7 +102,10 @@ namespace OpenSim.Tests.Common.Mock | |||
102 | 102 | ||
103 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {} | 103 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {} |
104 | 104 | ||
105 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; } | 105 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) |
106 | { | ||
107 | return new List<FriendListItem>(); | ||
108 | } | ||
106 | 109 | ||
107 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } | 110 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } |
108 | 111 | ||
diff --git a/prebuild.xml b/prebuild.xml index acad24d..cebb57c 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -2646,6 +2646,7 @@ | |||
2646 | <Reference name="System"/> | 2646 | <Reference name="System"/> |
2647 | <Reference name="log4net.dll"/> | 2647 | <Reference name="log4net.dll"/> |
2648 | <Reference name="nunit.framework.dll" /> | 2648 | <Reference name="nunit.framework.dll" /> |
2649 | <Reference name="XMLRPC.dll"/> | ||
2649 | <Reference name="OpenMetaverse.dll"/> | 2650 | <Reference name="OpenMetaverse.dll"/> |
2650 | <Reference name="OpenMetaverseTypes.dll"/> | 2651 | <Reference name="OpenMetaverseTypes.dll"/> |
2651 | <Reference name="OpenSim.Framework"/> | 2652 | <Reference name="OpenSim.Framework"/> |