remove inventory service preserving code from SceneSetupHelpers too

0.7.1-dev
Justin Clark-Casey (justincc) 2011-03-09 01:37:31 +00:00
parent f375a5e9cb
commit 2fa8fc5052
1 changed files with 10 additions and 37 deletions

View File

@ -57,10 +57,6 @@ namespace OpenSim.Tests.Common.Setup
/// </summary> /// </summary>
public class SceneSetupHelpers public class SceneSetupHelpers
{ {
// These static variables in order to allow regions to be linked by shared modules and same
// CommunicationsManager.
private static ISharedRegionModule m_inventoryService = null;
/// <summary> /// <summary>
/// Set up a test scene /// Set up a test scene
/// </summary> /// </summary>
@ -81,24 +77,9 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns> /// <returns></returns>
public static TestScene SetupScene(String realServices) public static TestScene SetupScene(String realServices)
{ {
return SetupScene( return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices);
"Unit test region", UUID.Random(), 1000, 1000, realServices);
} }
// REFACTORING PROBLEM. No idea what the difference is with the previous one
///// <summary>
///// Set up a test scene
///// </summary>
/////
///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
///// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
///// <returns></returns>
//public static TestScene SetupScene(String realServices)
//{
// return SetupScene(
// "Unit test region", UUID.Random(), 1000, 1000, "");
//}
/// <summary> /// <summary>
/// Set up a test scene /// Set up a test scene
/// </summary> /// </summary>
@ -110,7 +91,7 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns> /// <returns></returns>
public static TestScene SetupScene(string name, UUID id, uint x, uint y) public static TestScene SetupScene(string name, UUID id, uint x, uint y)
{ {
return SetupScene(name, id, x, y,""); return SetupScene(name, id, x, y, "");
} }
/// <summary> /// <summary>
@ -156,16 +137,12 @@ namespace OpenSim.Tests.Common.Setup
// For now, always started a 'real' authentication service // For now, always started a 'real' authentication service
StartAuthenticationService(testScene, true); StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory")) LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory"));
StartInventoryService(testScene, true);
else
StartInventoryService(testScene, false);
StartGridService(testScene, true); StartGridService(testScene, true);
LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
m_inventoryService.PostInitialise(); inventoryService.PostInitialise();
assetService.PostInitialise(); assetService.PostInitialise();
userAccountService.PostInitialise(); userAccountService.PostInitialise();
presenceService.PostInitialise(); presenceService.PostInitialise();
@ -181,11 +158,6 @@ namespace OpenSim.Tests.Common.Setup
testScene.PhysicsScene testScene.PhysicsScene
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
// It's really not a good idea to use static variables as they carry over between tests, leading to
// problems that are extremely hard to debug. Really, these static fields need to be eliminated -
// tests using multiple regions that need to share modules need to find another solution.
m_inventoryService = null;
testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.RegionInfo.EstateSettings = new EstateSettings();
testScene.LoginsDisabled = false; testScene.LoginsDisabled = false;
@ -233,9 +205,9 @@ namespace OpenSim.Tests.Common.Setup
//m_authenticationService = service; //m_authenticationService = service;
} }
private static void StartInventoryService(Scene testScene, bool real) private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real)
{ {
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
IConfigSource config = new IniConfigSource(); IConfigSource config = new IniConfigSource();
config.AddConfig("Modules"); config.AddConfig("Modules");
config.AddConfig("InventoryService"); config.AddConfig("InventoryService");
@ -255,7 +227,8 @@ namespace OpenSim.Tests.Common.Setup
inventoryService.AddRegion(testScene); inventoryService.AddRegion(testScene);
inventoryService.RegionLoaded(testScene); inventoryService.RegionLoaded(testScene);
testScene.AddRegionModule(inventoryService.Name, inventoryService); testScene.AddRegionModule(inventoryService.Name, inventoryService);
m_inventoryService = inventoryService;
return inventoryService;
} }
private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) private static LocalGridServicesConnector StartGridService(Scene testScene, bool real)
@ -423,7 +396,7 @@ namespace OpenSim.Tests.Common.Setup
/// <summary> /// <summary>
/// Add a root agent. /// Add a root agent.
/// </summary> /// </summary>
/// /// <remarks>
/// This function /// This function
/// ///
/// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
@ -434,7 +407,7 @@ namespace OpenSim.Tests.Common.Setup
/// ///
/// This function performs actions equivalent with notifying the scene that an agent is /// This function performs actions equivalent with notifying the scene that an agent is
/// coming and then actually connecting the agent to the scene. The one step missed out is the very first /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
/// /// </remarks>
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="agentData"></param> /// <param name="agentData"></param>
/// <returns></returns> /// <returns></returns>