diff options
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockUserAccountService.cs | 46 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 21 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 5 |
3 files changed, 11 insertions, 61 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs deleted file mode 100644 index 0769c7a..0000000 --- a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
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 OpenSimulator 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.Collections.Generic; | ||
29 | using Nini.Config; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Tests.Common.Mock | ||
34 | { | ||
35 | public class MockUserAccountService : IUserAccountService | ||
36 | { | ||
37 | |||
38 | public MockUserAccountService(IConfigSource config) {} | ||
39 | |||
40 | public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); } | ||
41 | public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); } | ||
42 | public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); } | ||
43 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) { return new List<UserAccount>(); } | ||
44 | public bool StoreUserAccount(UserAccount data) { return true; } | ||
45 | } | ||
46 | } \ No newline at end of file | ||
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 2756324..4a356e2 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | |||
@@ -191,7 +191,7 @@ namespace OpenSim.Tests.Common.Setup | |||
191 | if (realServices.Contains("grid")) | 191 | if (realServices.Contains("grid")) |
192 | StartGridService(testScene, true); | 192 | StartGridService(testScene, true); |
193 | 193 | ||
194 | StartUserAccountService(testScene, realServices.Contains("useraccounts")); | 194 | StartUserAccountService(testScene); |
195 | } | 195 | } |
196 | // If not, make sure the shared module gets references to this new scene | 196 | // If not, make sure the shared module gets references to this new scene |
197 | else | 197 | else |
@@ -260,7 +260,7 @@ namespace OpenSim.Tests.Common.Setup | |||
260 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); | 260 | "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); |
261 | else | 261 | else |
262 | config.Configs["AuthenticationService"].Set( | 262 | config.Configs["AuthenticationService"].Set( |
263 | "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService"); | 263 | "LocalServiceModule", "OpenSim.Tests.Common.dll:MockAuthenticationService"); |
264 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 264 | config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
265 | service.Initialise(config); | 265 | service.Initialise(config); |
266 | service.AddRegion(testScene); | 266 | service.AddRegion(testScene); |
@@ -311,24 +311,18 @@ namespace OpenSim.Tests.Common.Setup | |||
311 | } | 311 | } |
312 | 312 | ||
313 | /// <summary> | 313 | /// <summary> |
314 | /// Start a user account service, whether real or mock | 314 | /// Start a user account service |
315 | /// </summary> | 315 | /// </summary> |
316 | /// <param name="testScene"></param> | 316 | /// <param name="testScene"></param> |
317 | /// <param name="real">Starts a real service if true, a mock service if not</param> | 317 | private static void StartUserAccountService(Scene testScene) |
318 | private static void StartUserAccountService(Scene testScene, bool real) | ||
319 | { | 318 | { |
320 | IConfigSource config = new IniConfigSource(); | 319 | IConfigSource config = new IniConfigSource(); |
321 | config.AddConfig("Modules"); | 320 | config.AddConfig("Modules"); |
322 | config.AddConfig("UserAccountService"); | 321 | config.AddConfig("UserAccountService"); |
323 | config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); | 322 | config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); |
324 | config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); | 323 | config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); |
325 | 324 | config.Configs["UserAccountService"].Set( | |
326 | if (real) | 325 | "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); |
327 | config.Configs["UserAccountService"].Set( | ||
328 | "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); | ||
329 | else | ||
330 | config.Configs["UserAccountService"].Set( | ||
331 | "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService"); | ||
332 | 326 | ||
333 | if (m_userAccountService == null) | 327 | if (m_userAccountService == null) |
334 | { | 328 | { |
@@ -336,8 +330,7 @@ namespace OpenSim.Tests.Common.Setup | |||
336 | userAccountService.Initialise(config); | 330 | userAccountService.Initialise(config); |
337 | m_userAccountService = userAccountService; | 331 | m_userAccountService = userAccountService; |
338 | } | 332 | } |
339 | //else | 333 | |
340 | // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); | ||
341 | m_userAccountService.AddRegion(testScene); | 334 | m_userAccountService.AddRegion(testScene); |
342 | m_userAccountService.RegionLoaded(testScene); | 335 | m_userAccountService.RegionLoaded(testScene); |
343 | testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); | 336 | testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); |
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs index e6a7818..380f258 100644 --- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs +++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.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.Collections.Generic; | ||
28 | using OpenMetaverse; | 29 | using OpenMetaverse; |
29 | using OpenSim.Framework.Communications; | 30 | using OpenSim.Framework.Communications; |
30 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
@@ -124,7 +125,9 @@ namespace OpenSim.Tests.Common.Setup | |||
124 | public static UserAccount CreateUserWithInventory( | 125 | public static UserAccount CreateUserWithInventory( |
125 | Scene scene, string firstName, string lastName, UUID userId, string pw) | 126 | Scene scene, string firstName, string lastName, UUID userId, string pw) |
126 | { | 127 | { |
127 | UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName }; | 128 | UserAccount ua |
129 | = new UserAccount(userId) | ||
130 | { FirstName = firstName, LastName = lastName, ServiceURLs = new Dictionary<string, object>() }; | ||
128 | scene.UserAccountService.StoreUserAccount(ua); | 131 | scene.UserAccountService.StoreUserAccount(ua); |
129 | scene.InventoryService.CreateUserInventory(ua.PrincipalID); | 132 | scene.InventoryService.CreateUserInventory(ua.PrincipalID); |
130 | scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); | 133 | scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); |