From eb699df5f6c7a68a500e38dc994ed7c2f2aa89d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Feb 2011 22:49:19 +0000 Subject: On SceneSetupHelpers, go back to calling ScenePresence.CompleteMovement() for the last stage of AddRootAgent() instead of SP.MakeRootAgent() Going this extra step doesn't appear to cause any test failures. This is arguably better for test purposes, though at some stage another method may arise which does just call AddRootAgent(). --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 8b16496..d199e42 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -504,12 +504,10 @@ namespace OpenSim.Tests.Common.Setup TestClient client = new TestClient(agentData, scene); scene.AddNewClient(client); - // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, - // inventory, etc.) - //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE - + // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. ScenePresence scp = scene.GetScenePresence(agentData.AgentID); - scp.MakeRootAgent(new Vector3(90, 90, 90), true); + scp.CompleteMovement(client); + //scp.MakeRootAgent(new Vector3(90, 90, 90), true); return client; } -- cgit v1.1 From 60fe3d48ee83f004861044c51537256c0c389478 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 18 Feb 2011 23:50:54 +0000 Subject: Put some CapabilitiesModule null checks in Scene Stop tests setting up a capabilities module by default --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index d199e42..9142616 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -164,10 +164,10 @@ namespace OpenSim.Tests.Common.Setup TestScene testScene = new TestScene( regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); - INonSharedRegionModule capsModule = new CapabilitiesModule(); - capsModule.Initialise(new IniConfigSource()); - testScene.AddRegionModule(capsModule.Name, capsModule); - capsModule.AddRegion(testScene); +// INonSharedRegionModule capsModule = new CapabilitiesModule(); +// capsModule.Initialise(new IniConfigSource()); +// testScene.AddRegionModule(capsModule.Name, capsModule); +// capsModule.AddRegion(testScene); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); -- cgit v1.1 From 9d668b09ca893c706745cd2b8fb9b7922b6eeee6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Feb 2011 00:07:16 +0000 Subject: remove unused code to share services between scenes in SceneSetupHelpers - this is done differently elsewhere --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 68 ++++++------------------- 1 file changed, 16 insertions(+), 52 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 9142616..3980c18 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -132,24 +132,11 @@ namespace OpenSim.Tests.Common.Setup public static TestScene SetupScene( string name, UUID id, uint x, uint y, String realServices) { - bool newScene = false; - Console.WriteLine("Setting up test scene {0}", name); - // REFACTORING PROBLEM! - //// If cm is the same as our last commsManager used, this means the tester wants to link - //// regions. In this case, don't use the sameshared region modules and dont initialize them again. - //// Also, no need to start another MainServer and MainConsole instance. - //if (cm == null || cm != commsManager) - //{ - // System.Console.WriteLine("Starting a brand new scene"); - // newScene = true; - MainConsole.Instance = new MockConsole("TEST PROMPT"); - // MainServer.Instance = new BaseHttpServer(980); - // commsManager = cm; - //} - // We must set up a console otherwise setup of some modules may fail + MainConsole.Instance = new MockConsole("TEST PROMPT"); + RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); regInfo.RegionName = name; regInfo.RegionID = id; @@ -164,50 +151,27 @@ namespace OpenSim.Tests.Common.Setup TestScene testScene = new TestScene( regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); -// INonSharedRegionModule capsModule = new CapabilitiesModule(); -// capsModule.Initialise(new IniConfigSource()); -// testScene.AddRegionModule(capsModule.Name, capsModule); -// capsModule.AddRegion(testScene); - IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); - // IConfigSource config = new IniConfigSource(); - // If we have a brand new scene, need to initialize shared region modules - if ((m_assetService == null && m_inventoryService == null) || newScene) - { - if (realServices.Contains("asset")) - StartAssetService(testScene, true); - else - StartAssetService(testScene, false); - - // For now, always started a 'real' authentication service - StartAuthenticationService(testScene, true); - - if (realServices.Contains("inventory")) - StartInventoryService(testScene, true); - else - StartInventoryService(testScene, false); - - StartGridService(testScene, true); - StartUserAccountService(testScene); - StartPresenceService(testScene); - } - // If not, make sure the shared module gets references to this new scene + if (realServices.Contains("asset")) + StartAssetService(testScene, true); else - { - m_assetService.AddRegion(testScene); - m_assetService.RegionLoaded(testScene); - m_inventoryService.AddRegion(testScene); - m_inventoryService.RegionLoaded(testScene); - m_userAccountService.AddRegion(testScene); - m_userAccountService.RegionLoaded(testScene); - m_presenceService.AddRegion(testScene); - m_presenceService.RegionLoaded(testScene); + StartAssetService(testScene, false); - } + // For now, always started a 'real' authentication service + StartAuthenticationService(testScene, true); + + if (realServices.Contains("inventory")) + StartInventoryService(testScene, true); + else + StartInventoryService(testScene, false); + + StartGridService(testScene, true); + StartUserAccountService(testScene); + StartPresenceService(testScene); m_inventoryService.PostInitialise(); m_assetService.PostInitialise(); -- cgit v1.1 From b3a1d8c7f787dd2ad24b925bfcdd08b676b3d8b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 19 Feb 2011 00:11:08 +0000 Subject: Remove unused SceneSetupHelpers.DeleteObjectAsync(). Calling async code in automated tests is never a good idea - things become very fragile very quickly --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 3980c18..5be70bc 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -505,24 +505,5 @@ namespace OpenSim.Tests.Common.Setup return part; } - - /// - /// Delete a scene object asynchronously - /// - /// - /// - /// - /// - /// - public static void DeleteSceneObjectAsync( - TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) - { - // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test - AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; - - scene.DeRezObjects(client, new List() { part.LocalId }, UUID.Zero, action, destinationId); - sogd.InventoryDeQueueAndDelete(); - } } } -- cgit v1.1 From 8a2360bf815d4d78fcff34a69dec24782494bd2e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 Mar 2011 01:21:31 +0000 Subject: Simplify TestLoadIarV0_1AbsentUsers() to use common IAR test setup. Make static dictionaries on NullUserAccountData instance instead to stop user accounts being carried over between tests --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 5be70bc..08cc7c5 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -304,12 +304,12 @@ namespace OpenSim.Tests.Common.Setup config.Configs["UserAccountService"].Set( "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); - if (m_userAccountService == null) - { +// if (m_userAccountService == null) +// { ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); userAccountService.Initialise(config); m_userAccountService = userAccountService; - } +// } m_userAccountService.AddRegion(testScene); m_userAccountService.RegionLoaded(testScene); -- cgit v1.1 From f375a5e9cbe96b0a07c52f27b0a4b2b620e5d6d8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 Mar 2011 01:31:47 +0000 Subject: Simplify SceneSetupHelpers class by removing all code which was originally preserving service instances between tests. This wasn't being used anyway and just leads to hard to diagnose test failures. --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 93 +++++++++++-------------- 1 file changed, 40 insertions(+), 53 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 08cc7c5..2aeafc8 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -59,19 +59,14 @@ 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; - private static ISharedRegionModule m_presenceService = null; /// /// Set up a test scene /// - /// + /// /// Automatically starts service threads, as would the normal runtime. - /// + /// /// public static TestScene SetupScene() { @@ -156,10 +151,7 @@ namespace OpenSim.Tests.Common.Setup testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); - if (realServices.Contains("asset")) - StartAssetService(testScene, true); - else - StartAssetService(testScene, false); + LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset")); // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); @@ -169,14 +161,15 @@ namespace OpenSim.Tests.Common.Setup else StartInventoryService(testScene, false); - StartGridService(testScene, true); - StartUserAccountService(testScene); - StartPresenceService(testScene); + StartGridService(testScene, true); + LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); + LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); m_inventoryService.PostInitialise(); - m_assetService.PostInitialise(); - m_userAccountService.PostInitialise(); - m_presenceService.PostInitialise(); + assetService.PostInitialise(); + userAccountService.PostInitialise(); + presenceService.PostInitialise(); + testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.SetModuleInterfaces(); @@ -191,11 +184,7 @@ namespace OpenSim.Tests.Common.Setup // 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_assetService = null; m_inventoryService = null; - m_gridService = null; - m_userAccountService = null; - m_presenceService = null; testScene.RegionInfo.EstateSettings = new EstateSettings(); testScene.LoginsDisabled = false; @@ -203,9 +192,9 @@ namespace OpenSim.Tests.Common.Setup return testScene; } - private static void StartAssetService(Scene testScene, bool real) + private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real) { - ISharedRegionModule assetService = new LocalAssetServicesConnector(); + LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("AssetService"); @@ -219,7 +208,8 @@ namespace OpenSim.Tests.Common.Setup assetService.AddRegion(testScene); assetService.RegionLoaded(testScene); testScene.AddRegionModule(assetService.Name, assetService); - m_assetService = assetService; + + return assetService; } private static void StartAuthenticationService(Scene testScene, bool real) @@ -268,7 +258,7 @@ namespace OpenSim.Tests.Common.Setup m_inventoryService = inventoryService; } - private static void StartGridService(Scene testScene, bool real) + private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -277,24 +267,25 @@ namespace OpenSim.Tests.Common.Setup config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); if (real) config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); - if (m_gridService == null) - { - ISharedRegionModule gridService = new LocalGridServicesConnector(); - gridService.Initialise(config); - m_gridService = gridService; - } + + LocalGridServicesConnector gridService = new LocalGridServicesConnector(); + gridService.Initialise(config); + //else // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); - m_gridService.AddRegion(testScene); - m_gridService.RegionLoaded(testScene); + gridService.AddRegion(testScene); + gridService.RegionLoaded(testScene); //testScene.AddRegionModule(m_gridService.Name, m_gridService); + + return gridService; } /// /// Start a user account service /// /// - private static void StartUserAccountService(Scene testScene) + /// + private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene) { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -304,23 +295,21 @@ namespace OpenSim.Tests.Common.Setup config.Configs["UserAccountService"].Set( "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); -// if (m_userAccountService == null) -// { - ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); - userAccountService.Initialise(config); - m_userAccountService = userAccountService; -// } + LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); + userAccountService.Initialise(config); - m_userAccountService.AddRegion(testScene); - m_userAccountService.RegionLoaded(testScene); - testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); + userAccountService.AddRegion(testScene); + userAccountService.RegionLoaded(testScene); + testScene.AddRegionModule(userAccountService.Name, userAccountService); + + return userAccountService; } /// /// Start a presence service /// /// - private static void StartPresenceService(Scene testScene) + private static LocalPresenceServicesConnector StartPresenceService(Scene testScene) { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -330,16 +319,14 @@ namespace OpenSim.Tests.Common.Setup config.Configs["PresenceService"].Set( "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); - if (m_presenceService == null) - { - ISharedRegionModule presenceService = new LocalPresenceServicesConnector(); - presenceService.Initialise(config); - m_presenceService = presenceService; - } + LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); + presenceService.Initialise(config); - m_presenceService.AddRegion(testScene); - m_presenceService.RegionLoaded(testScene); - testScene.AddRegionModule(m_presenceService.Name, m_presenceService); + presenceService.AddRegion(testScene); + presenceService.RegionLoaded(testScene); + testScene.AddRegionModule(presenceService.Name, presenceService); + + return presenceService; } /// -- cgit v1.1 From 2fa8fc505223cbd2b6e327fe946748c717dda3b5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 Mar 2011 01:37:31 +0000 Subject: remove inventory service preserving code from SceneSetupHelpers too --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 47 ++++++------------------- 1 file changed, 10 insertions(+), 37 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 2aeafc8..aa4b285 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -57,10 +57,6 @@ namespace OpenSim.Tests.Common.Setup /// 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; - /// /// Set up a test scene /// @@ -81,24 +77,9 @@ namespace OpenSim.Tests.Common.Setup /// public static TestScene SetupScene(String realServices) { - return SetupScene( - "Unit test region", UUID.Random(), 1000, 1000, realServices); + return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices); } - // REFACTORING PROBLEM. No idea what the difference is with the previous one - ///// - ///// Set up a test scene - ///// - ///// - ///// Starts real inventory and asset services, as opposed to mock ones, if true - ///// This should be the same if simulating two scenes within a standalone - ///// - //public static TestScene SetupScene(String realServices) - //{ - // return SetupScene( - // "Unit test region", UUID.Random(), 1000, 1000, ""); - //} - /// /// Set up a test scene /// @@ -110,7 +91,7 @@ namespace OpenSim.Tests.Common.Setup /// public static TestScene SetupScene(string name, UUID id, uint x, uint y) { - return SetupScene(name, id, x, y,""); + return SetupScene(name, id, x, y, ""); } /// @@ -156,16 +137,12 @@ namespace OpenSim.Tests.Common.Setup // For now, always started a 'real' authentication service StartAuthenticationService(testScene, true); - if (realServices.Contains("inventory")) - StartInventoryService(testScene, true); - else - StartInventoryService(testScene, false); - + LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory")); StartGridService(testScene, true); LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); - m_inventoryService.PostInitialise(); + inventoryService.PostInitialise(); assetService.PostInitialise(); userAccountService.PostInitialise(); presenceService.PostInitialise(); @@ -181,11 +158,6 @@ namespace OpenSim.Tests.Common.Setup testScene.PhysicsScene = 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.LoginsDisabled = false; @@ -233,9 +205,9 @@ namespace OpenSim.Tests.Common.Setup //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(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); @@ -255,7 +227,8 @@ namespace OpenSim.Tests.Common.Setup inventoryService.AddRegion(testScene); inventoryService.RegionLoaded(testScene); testScene.AddRegionModule(inventoryService.Name, inventoryService); - m_inventoryService = inventoryService; + + return inventoryService; } private static LocalGridServicesConnector StartGridService(Scene testScene, bool real) @@ -423,7 +396,7 @@ namespace OpenSim.Tests.Common.Setup /// /// Add a root agent. /// - /// + /// /// This function /// /// 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 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first - /// + /// /// /// /// -- cgit v1.1