From 505cb82dee27fc1b681fd7c4b6f904ef18315995 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 28 May 2010 21:14:15 +0100
Subject: fission UserAccountService.HandleCreateUser() into two methods, one
which handles user command parsing and another which actually does the work
---
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 159 ++++++++++-----------
1 file changed, 78 insertions(+), 81 deletions(-)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index cd61fa6..2b14d97 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -36,85 +36,82 @@ namespace OpenSim.Tests.Common.Setup
///
public static class UserProfileTestUtils
{
- // REFACTORING PROBLEM
- // This needs to be rewritten
-
- /////
- ///// Create a test user with a standard inventory
- /////
- /////
- /////
- ///// Callback to invoke when inventory has been loaded. This is required because
- ///// loading may be asynchronous, even on standalone
- /////
- /////
- //public static CachedUserInfo CreateUserWithInventory(
- // CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
- //{
- // UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
- // return CreateUserWithInventory(commsManager, userId, callback);
- //}
-
- /////
- ///// Create a test user with a standard inventory
- /////
- /////
- ///// User ID
- /////
- ///// Callback to invoke when inventory has been loaded. This is required because
- ///// loading may be asynchronous, even on standalone
- /////
- /////
- //public static CachedUserInfo CreateUserWithInventory(
- // CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
- //{
- // return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
- //}
-
- /////
- ///// Create a test user with a standard inventory
- /////
- /////
- ///// First name of user
- ///// Last name of user
- ///// User ID
- /////
- ///// Callback to invoke when inventory has been loaded. This is required because
- ///// loading may be asynchronous, even on standalone
- /////
- /////
- //public static CachedUserInfo CreateUserWithInventory(
- // CommunicationsManager commsManager, string firstName, string lastName,
- // UUID userId, OnInventoryReceivedDelegate callback)
- //{
- // return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
- //}
-
- /////
- ///// Create a test user with a standard inventory
- /////
- /////
- ///// First name of user
- ///// Last name of user
- ///// Password
- ///// User ID
- /////
- ///// Callback to invoke when inventory has been loaded. This is required because
- ///// loading may be asynchronous, even on standalone
- /////
- /////
- //public static CachedUserInfo CreateUserWithInventory(
- // CommunicationsManager commsManager, string firstName, string lastName, string password,
- // UUID userId, OnInventoryReceivedDelegate callback)
- //{
- // LocalUserServices lus = (LocalUserServices)commsManager.UserService;
- // lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
-
- // CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
- // userInfo.OnInventoryReceived += callback;
- // userInfo.FetchInventory();
-
- // return userInfo;
- //}
+// ///
+// /// Create a test user with a standard inventory
+// ///
+// ///
+// ///
+// /// Callback to invoke when inventory has been loaded. This is required because
+// /// loading may be asynchronous, even on standalone
+// ///
+// ///
+// public static CachedUserInfo CreateUserWithInventory(
+// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
+// {
+// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
+// return CreateUserWithInventory(commsManager, userId, callback);
+// }
+//
+// ///
+// /// Create a test user with a standard inventory
+// ///
+// ///
+// /// User ID
+// ///
+// /// Callback to invoke when inventory has been loaded. This is required because
+// /// loading may be asynchronous, even on standalone
+// ///
+// ///
+// public static CachedUserInfo CreateUserWithInventory(
+// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
+// {
+// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
+// }
+//
+// ///
+// /// Create a test user with a standard inventory
+// ///
+// ///
+// /// First name of user
+// /// Last name of user
+// /// User ID
+// ///
+// /// Callback to invoke when inventory has been loaded. This is required because
+// /// loading may be asynchronous, even on standalone
+// ///
+// ///
+// public static CachedUserInfo CreateUserWithInventory(
+// CommunicationsManager commsManager, string firstName, string lastName,
+// UUID userId, OnInventoryReceivedDelegate callback)
+// {
+// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
+// }
+//
+// ///
+// /// Create a test user with a standard inventory
+// ///
+// ///
+// /// First name of user
+// /// Last name of user
+// /// Password
+// /// User ID
+// ///
+// /// Callback to invoke when inventory has been loaded. This is required because
+// /// loading may be asynchronous, even on standalone
+// ///
+// ///
+// public static CachedUserInfo CreateUserWithInventory(
+// CommunicationsManager commsManager, string firstName, string lastName, string password,
+// UUID userId, OnInventoryReceivedDelegate callback)
+// {
+// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
+// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
+//
+// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
+// userInfo.OnInventoryReceived += callback;
+// userInfo.FetchInventory();
+//
+// return userInfo;
+// }
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From a60ca5236c247b88909a3c0462675627575b334c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 28 May 2010 21:37:48 +0100
Subject: restore
InventoryArchiverTests.TestReplicateArchivePathToUserInventory() to work with
the new UserAccountService/InventoryService
---
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index 2b14d97..a6b9520 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -27,7 +27,8 @@
using OpenMetaverse;
using OpenSim.Framework.Communications;
-
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Setup
{
@@ -113,5 +114,15 @@ namespace OpenSim.Tests.Common.Setup
//
// return userInfo;
// }
+
+ public static UserAccount CreateUserWithInventory(Scene scene)
+ {
+ UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
+ UserAccount ua = new UserAccount(userId) { FirstName = "Bill", LastName = "Bailey" };
+ scene.UserAccountService.StoreUserAccount(ua);
+ scene.InventoryService.CreateUserInventory(ua.PrincipalID);
+
+ return ua;
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 191db0e6a4327e8bf84350a541a9edc579ae1c54 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 28 May 2010 23:14:24 +0100
Subject: get TestSaveIarV0_1() uncommented but not running as a test yet since
I didn't get the authentication server to work and my brain is about to
fizzle out my ears
---
OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 28 +++++++++++++++++++++-
OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs | 13 +++++++---
2 files changed, 37 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Tests')
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;
using OpenSim.Region.CoreModules.Agent.Capabilities;
using OpenSim.Region.CoreModules.Avatar.Gods;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset;
+using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
@@ -58,6 +59,7 @@ namespace OpenSim.Tests.Common.Setup
// These static variables in order to allow regions to be linked by shared modules and same
// CommunicationsManager.
private static ISharedRegionModule m_assetService = null;
+// private static ISharedRegionModule m_authenticationService = null;
private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null;
@@ -177,6 +179,9 @@ namespace OpenSim.Tests.Common.Setup
StartAssetService(testScene, true);
else
StartAssetService(testScene, false);
+
+ // For now, always started a 'real' authenication service
+ StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory"))
StartInventoryService(testScene, true);
@@ -236,13 +241,34 @@ namespace OpenSim.Tests.Common.Setup
else
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
- assetService.Initialise(config);
+ assetService.Initialise(config);
assetService.AddRegion(testScene);
assetService.RegionLoaded(testScene);
testScene.AddRegionModule(assetService.Name, assetService);
m_assetService = assetService;
}
+ private static void StartAuthenticationService(Scene testScene, bool real)
+ {
+ ISharedRegionModule service = new LocalAuthenticationServicesConnector();
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.AddConfig("AuthenticationService");
+ config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector");
+ if (real)
+ config.Configs["AuthenticationService"].Set(
+ "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService");
+ else
+ config.Configs["AuthenticationService"].Set(
+ "LocalServiceModule", "OpenSim.Tests.Common.dll:MockuthenticationService");
+ config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
+ service.Initialise(config);
+ service.AddRegion(testScene);
+ service.RegionLoaded(testScene);
+ testScene.AddRegionModule(service.Name, service);
+ //m_authenticationService = service;
+ }
+
private static void StartInventoryService(Scene testScene, bool real)
{
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index a6b9520..e6a7818 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -117,12 +117,19 @@ namespace OpenSim.Tests.Common.Setup
public static UserAccount CreateUserWithInventory(Scene scene)
{
- UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
- UserAccount ua = new UserAccount(userId) { FirstName = "Bill", LastName = "Bailey" };
+ return CreateUserWithInventory(
+ scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
+ }
+
+ public static UserAccount CreateUserWithInventory(
+ Scene scene, string firstName, string lastName, UUID userId, string pw)
+ {
+ UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID);
+ scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
return ua;
- }
+ }
}
}
\ No newline at end of file
--
cgit v1.1