mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 20:55:43 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Tests.Common.Setup
|
||||
{
|
||||
@@ -36,85 +37,99 @@ namespace OpenSim.Tests.Common.Setup
|
||||
/// </summary>
|
||||
public static class UserProfileTestUtils
|
||||
{
|
||||
// REFACTORING PROBLEM
|
||||
// This needs to be rewritten
|
||||
// /// <summary>
|
||||
// /// Create a test user with a standard inventory
|
||||
// /// </summary>
|
||||
// /// <param name="commsManager"></param>
|
||||
// /// <param name="callback">
|
||||
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||
// /// loading may be asynchronous, even on standalone
|
||||
// /// </param>
|
||||
// /// <returns></returns>
|
||||
// public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
|
||||
// {
|
||||
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
|
||||
// return CreateUserWithInventory(commsManager, userId, callback);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Create a test user with a standard inventory
|
||||
// /// </summary>
|
||||
// /// <param name="commsManager"></param>
|
||||
// /// <param name="userId">User ID</param>
|
||||
// /// <param name="callback">
|
||||
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||
// /// loading may be asynchronous, even on standalone
|
||||
// /// </param>
|
||||
// /// <returns></returns>
|
||||
// public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
|
||||
// {
|
||||
// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Create a test user with a standard inventory
|
||||
// /// </summary>
|
||||
// /// <param name="commsManager"></param>
|
||||
// /// <param name="firstName">First name of user</param>
|
||||
// /// <param name="lastName">Last name of user</param>
|
||||
// /// <param name="userId">User ID</param>
|
||||
// /// <param name="callback">
|
||||
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||
// /// loading may be asynchronous, even on standalone
|
||||
// /// </param>
|
||||
// /// <returns></returns>
|
||||
// public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, string firstName, string lastName,
|
||||
// UUID userId, OnInventoryReceivedDelegate callback)
|
||||
// {
|
||||
// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Create a test user with a standard inventory
|
||||
// /// </summary>
|
||||
// /// <param name="commsManager"></param>
|
||||
// /// <param name="firstName">First name of user</param>
|
||||
// /// <param name="lastName">Last name of user</param>
|
||||
// /// <param name="password">Password</param>
|
||||
// /// <param name="userId">User ID</param>
|
||||
// /// <param name="callback">
|
||||
// /// Callback to invoke when inventory has been loaded. This is required because
|
||||
// /// loading may be asynchronous, even on standalone
|
||||
// /// </param>
|
||||
// /// <returns></returns>
|
||||
// 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;
|
||||
// }
|
||||
|
||||
///// <summary>
|
||||
///// Create a test user with a standard inventory
|
||||
///// </summary>
|
||||
///// <param name="commsManager"></param>
|
||||
///// <param name="callback">
|
||||
///// Callback to invoke when inventory has been loaded. This is required because
|
||||
///// loading may be asynchronous, even on standalone
|
||||
///// </param>
|
||||
///// <returns></returns>
|
||||
//public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, OnInventoryReceivedDelegate callback)
|
||||
//{
|
||||
// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
|
||||
// return CreateUserWithInventory(commsManager, userId, callback);
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Create a test user with a standard inventory
|
||||
///// </summary>
|
||||
///// <param name="commsManager"></param>
|
||||
///// <param name="userId">User ID</param>
|
||||
///// <param name="callback">
|
||||
///// Callback to invoke when inventory has been loaded. This is required because
|
||||
///// loading may be asynchronous, even on standalone
|
||||
///// </param>
|
||||
///// <returns></returns>
|
||||
//public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, UUID userId, OnInventoryReceivedDelegate callback)
|
||||
//{
|
||||
// return CreateUserWithInventory(commsManager, "Bill", "Bailey", userId, callback);
|
||||
//}
|
||||
public static UserAccount CreateUserWithInventory(Scene scene)
|
||||
{
|
||||
return CreateUserWithInventory(
|
||||
scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Create a test user with a standard inventory
|
||||
///// </summary>
|
||||
///// <param name="commsManager"></param>
|
||||
///// <param name="firstName">First name of user</param>
|
||||
///// <param name="lastName">Last name of user</param>
|
||||
///// <param name="userId">User ID</param>
|
||||
///// <param name="callback">
|
||||
///// Callback to invoke when inventory has been loaded. This is required because
|
||||
///// loading may be asynchronous, even on standalone
|
||||
///// </param>
|
||||
///// <returns></returns>
|
||||
//public static CachedUserInfo CreateUserWithInventory(
|
||||
// CommunicationsManager commsManager, string firstName, string lastName,
|
||||
// UUID userId, OnInventoryReceivedDelegate callback)
|
||||
//{
|
||||
// return CreateUserWithInventory(commsManager, firstName, lastName, "troll", userId, callback);
|
||||
//}
|
||||
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);
|
||||
|
||||
///// <summary>
|
||||
///// Create a test user with a standard inventory
|
||||
///// </summary>
|
||||
///// <param name="commsManager"></param>
|
||||
///// <param name="firstName">First name of user</param>
|
||||
///// <param name="lastName">Last name of user</param>
|
||||
///// <param name="password">Password</param>
|
||||
///// <param name="userId">User ID</param>
|
||||
///// <param name="callback">
|
||||
///// Callback to invoke when inventory has been loaded. This is required because
|
||||
///// loading may be asynchronous, even on standalone
|
||||
///// </param>
|
||||
///// <returns></returns>
|
||||
//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;
|
||||
//}
|
||||
return ua;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user