aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorTom Grimshaw2010-05-29 01:07:19 -0700
committerTom Grimshaw2010-05-29 01:07:19 -0700
commit3a5d379db840570b4a759afc1f51ff82e61a5887 (patch)
treebef5b2e8149a89d49e38e9e8cfbbb48e0fa0db29 /OpenSim/Tests
parentStop IGridService from throwing a fatal exception when an IPEndPoint cannot b... (diff)
parentGet the user's DOB back from the server response properly. (diff)
downloadopensim-SC-3a5d379db840570b4a759afc1f51ff82e61a5887.zip
opensim-SC-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.gz
opensim-SC-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.bz2
opensim-SC-3a5d379db840570b4a759afc1f51ff82e61a5887.tar.xz
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs28
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs173
2 files changed, 121 insertions, 80 deletions
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 91cf323..2756324 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.CoreModules.Agent.Capabilities; 42using OpenSim.Region.CoreModules.Agent.Capabilities;
43using OpenSim.Region.CoreModules.Avatar.Gods; 43using OpenSim.Region.CoreModules.Avatar.Gods;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
45using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
47using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
@@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
58 // These static variables in order to allow regions to be linked by shared modules and same 59 // These static variables in order to allow regions to be linked by shared modules and same
59 // CommunicationsManager. 60 // CommunicationsManager.
60 private static ISharedRegionModule m_assetService = null; 61 private static ISharedRegionModule m_assetService = null;
62// private static ISharedRegionModule m_authenticationService = null;
61 private static ISharedRegionModule m_inventoryService = null; 63 private static ISharedRegionModule m_inventoryService = null;
62 private static ISharedRegionModule m_gridService = null; 64 private static ISharedRegionModule m_gridService = null;
63 private static ISharedRegionModule m_userAccountService = null; 65 private static ISharedRegionModule m_userAccountService = null;
@@ -177,6 +179,9 @@ namespace OpenSim.Tests.Common.Setup
177 StartAssetService(testScene, true); 179 StartAssetService(testScene, true);
178 else 180 else
179 StartAssetService(testScene, false); 181 StartAssetService(testScene, false);
182
183 // For now, always started a 'real' authenication service
184 StartAuthenticationService(testScene, true);
180 185
181 if (realServices.Contains("inventory")) 186 if (realServices.Contains("inventory"))
182 StartInventoryService(testScene, true); 187 StartInventoryService(testScene, true);
@@ -236,13 +241,34 @@ namespace OpenSim.Tests.Common.Setup
236 else 241 else
237 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); 242 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
238 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 243 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
239 assetService.Initialise(config); 244 assetService.Initialise(config);
240 assetService.AddRegion(testScene); 245 assetService.AddRegion(testScene);
241 assetService.RegionLoaded(testScene); 246 assetService.RegionLoaded(testScene);
242 testScene.AddRegionModule(assetService.Name, assetService); 247 testScene.AddRegionModule(assetService.Name, assetService);
243 m_assetService = assetService; 248 m_assetService = assetService;
244 } 249 }
245 250
251 private static void StartAuthenticationService(Scene testScene, bool real)
252 {
253 ISharedRegionModule service = new LocalAuthenticationServicesConnector();
254 IConfigSource config = new IniConfigSource();
255 config.AddConfig("Modules");
256 config.AddConfig("AuthenticationService");
257 config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
258 if (real)
259 config.Configs["AuthenticationService"].Set(
260 "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
261 else
262 config.Configs["AuthenticationService"].Set(
263 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService");
264 config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
265 service.Initialise(config);
266 service.AddRegion(testScene);
267 service.RegionLoaded(testScene);
268 testScene.AddRegionModule(service.Name, service);
269 //m_authenticationService = service;
270 }
271
246 private static void StartInventoryService(Scene testScene, bool real) 272 private static void StartInventoryService(Scene testScene, bool real)
247 { 273 {
248 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 274 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index cd61fa6..e6a7818 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -27,7 +27,8 @@
27 27
28using OpenMetaverse; 28using OpenMetaverse;
29using OpenSim.Framework.Communications; 29using OpenSim.Framework.Communications;
30 30using OpenSim.Region.Framework.Scenes;
31using OpenSim.Services.Interfaces;
31 32
32namespace OpenSim.Tests.Common.Setup 33namespace OpenSim.Tests.Common.Setup
33{ 34{
@@ -36,85 +37,99 @@ namespace OpenSim.Tests.Common.Setup
36 /// </summary> 37 /// </summary>
37 public static class UserProfileTestUtils 38 public static class UserProfileTestUtils
38 { 39 {
39 // REFACTORING PROBLEM 40// /// <summary>
40 // This needs to be rewritten 41// /// Create a test user with a standard inventory
42// /// </summary>
43// /// <param name="commsManager"></param>
44// /// <param name="callback">
45// /// Callback to invoke when inventory has been loaded. This is required because
46// /// loading may be asynchronous, even on standalone
47// /// </param>
48// /// <returns></returns>
49// public static CachedUserInfo CreateUserWithInventory(
50// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
51// {
52// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
53// return CreateUserWithInventory(commsManager, userId, callback);
54// }
55//
56// /// <summary>
57// /// Create a test user with a standard inventory
58// /// </summary>
59// /// <param name="commsManager"></param>
60// /// <param name="userId">User ID</param>
61// /// <param name="callback">
62// /// Callback to invoke when inventory has been loaded. This is required because
63// /// loading may be asynchronous, even on standalone
64// /// </param>
65// /// <returns></returns>
66// public static CachedUserInfo CreateUserWithInventory(
67// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
68// {
69// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
70// }
71//
72// /// <summary>
73// /// Create a test user with a standard inventory
74// /// </summary>
75// /// <param name="commsManager"></param>
76// /// <param name="firstName">First name of user</param>
77// /// <param name="lastName">Last name of user</param>
78// /// <param name="userId">User ID</param>
79// /// <param name="callback">
80// /// Callback to invoke when inventory has been loaded. This is required because
81// /// loading may be asynchronous, even on standalone
82// /// </param>
83// /// <returns></returns>
84// public static CachedUserInfo CreateUserWithInventory(
85// CommunicationsManager commsManager, string firstName, string lastName,
86// UUID userId, OnInventoryReceivedDelegate callback)
87// {
88// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
89// }
90//
91// /// <summary>
92// /// Create a test user with a standard inventory
93// /// </summary>
94// /// <param name="commsManager"></param>
95// /// <param name="firstName">First name of user</param>
96// /// <param name="lastName">Last name of user</param>
97// /// <param name="password">Password</param>
98// /// <param name="userId">User ID</param>
99// /// <param name="callback">
100// /// Callback to invoke when inventory has been loaded. This is required because
101// /// loading may be asynchronous, even on standalone
102// /// </param>
103// /// <returns></returns>
104// public static CachedUserInfo CreateUserWithInventory(
105// CommunicationsManager commsManager, string firstName, string lastName, string password,
106// UUID userId, OnInventoryReceivedDelegate callback)
107// {
108// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
109// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
110//
111// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
112// userInfo.OnInventoryReceived += callback;
113// userInfo.FetchInventory();
114//
115// return userInfo;
116// }
41 117
42 ///// <summary> 118 public static UserAccount CreateUserWithInventory(Scene scene)
43 ///// Create a test user with a standard inventory 119 {
44 ///// </summary> 120 return CreateUserWithInventory(
45 ///// <param name="commsManager"></param> 121 scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
46 ///// <param name="callback"> 122 }
47 ///// Callback to invoke when inventory has been loaded. This is required because
48 ///// loading may be asynchronous, even on standalone
49 ///// </param>
50 ///// <returns></returns>
51 //public static CachedUserInfo CreateUserWithInventory(
52 // CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
53 //{
54 // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
55 // return CreateUserWithInventory(commsManager, userId, callback);
56 //}
57
58 ///// <summary>
59 ///// Create a test user with a standard inventory
60 ///// </summary>
61 ///// <param name="commsManager"></param>
62 ///// <param name="userId">User ID</param>
63 ///// <param name="callback">
64 ///// Callback to invoke when inventory has been loaded. This is required because
65 ///// loading may be asynchronous, even on standalone
66 ///// </param>
67 ///// <returns></returns>
68 //public static CachedUserInfo CreateUserWithInventory(
69 // CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
70 //{
71 // return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
72 //}
73 123
74 ///// <summary> 124 public static UserAccount CreateUserWithInventory(
75 ///// Create a test user with a standard inventory 125 Scene scene, string firstName, string lastName, UUID userId, string pw)
76 ///// </summary> 126 {
77 ///// <param name="commsManager"></param> 127 UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
78 ///// <param name="firstName">First name of user</param> 128 scene.UserAccountService.StoreUserAccount(ua);
79 ///// <param name="lastName">Last name of user</param> 129 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
80 ///// <param name="userId">User ID</param> 130 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
81 ///// <param name="callback">
82 ///// Callback to invoke when inventory has been loaded. This is required because
83 ///// loading may be asynchronous, even on standalone
84 ///// </param>
85 ///// <returns></returns>
86 //public static CachedUserInfo CreateUserWithInventory(
87 // CommunicationsManager commsManager, string firstName, string lastName,
88 // UUID userId, OnInventoryReceivedDelegate callback)
89 //{
90 // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
91 //}
92 131
93 ///// <summary> 132 return ua;
94 ///// Create a test user with a standard inventory 133 }
95 ///// </summary>
96 ///// <param name="commsManager"></param>
97 ///// <param name="firstName">First name of user</param>
98 ///// <param name="lastName">Last name of user</param>
99 ///// <param name="password">Password</param>
100 ///// <param name="userId">User ID</param>
101 ///// <param name="callback">
102 ///// Callback to invoke when inventory has been loaded. This is required because
103 ///// loading may be asynchronous, even on standalone
104 ///// </param>
105 ///// <returns></returns>
106 //public static CachedUserInfo CreateUserWithInventory(
107 // CommunicationsManager commsManager, string firstName, string lastName, string password,
108 // UUID userId, OnInventoryReceivedDelegate callback)
109 //{
110 // LocalUserServices lus = (LocalUserServices)commsManager.UserService;
111 // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
112
113 // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
114 // userInfo.OnInventoryReceived += callback;
115 // userInfo.FetchInventory();
116
117 // return userInfo;
118 //}
119 } 134 }
120} 135} \ No newline at end of file