From 3fb0103452e58253db5592ecf712615331d4d601 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 27 Apr 2012 00:58:54 +0100 Subject: [PATCH] Add regression test for teleporting an agent between separated regions on the same simulator. This involves a large amount of change in test scene setup code to allow test scenes to share shared modules SetupScene is now an instance method that requires an instantiation of SceneHelpers, though other SceneHelpers methods are still static May split these out into separate classes in the future. --- .../Tests/GetTextureHandlerTests.cs | 2 +- .../Caps/EventQueue/Tests/EventQueueTests.cs | 2 +- .../Linden/UDP/Tests/BasicCircuitTests.cs | 2 +- .../Linden/UDP/Tests/LLImageManagerTests.cs | 2 +- .../Asset/Tests/FlotsamAssetCacheTests.cs | 2 +- .../Tests/AttachmentsModuleTests.cs | 2 +- .../Tests/AvatarFactoryModuleTests.cs | 4 +- .../Avatar/Friends/Tests/FriendModuleTests.cs | 2 +- .../Tests/InventoryArchiveTestCase.cs | 2 +- .../Archiver/Tests/InventoryArchiverTests.cs | 2 +- .../Inventory/Archiver/Tests/PathTests.cs | 14 +- .../EntityTransfer/EntityTransferModule.cs | 3 +- .../Tests/InventoryAccessModuleTests.cs | 2 +- .../World/Archiver/Tests/ArchiverTests.cs | 6 +- .../World/Land/Tests/PrimCountModuleTests.cs | 2 +- .../World/Media/Moap/Tests/MoapTests.cs | 2 +- .../World/Serialiser/Tests/SerialiserTests.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 8 +- .../Scenes/Tests/EntityManagerTests.cs | 2 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 10 +- .../Scenes/Tests/SceneObjectDeRezTests.cs | 4 +- .../Scenes/Tests/SceneObjectLinkingTests.cs | 10 +- .../Scenes/Tests/SceneObjectResizeTests.cs | 4 +- .../Scenes/Tests/SceneObjectScriptTests.cs | 2 +- .../Scenes/Tests/SceneObjectSpatialTests.cs | 2 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 10 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 2 +- .../Scenes/Tests/ScenePresenceAgentTests.cs | 18 +- .../Tests/ScenePresenceAnimationTests.cs | 2 +- .../Tests/ScenePresenceAutopilotTests.cs | 2 +- .../Scenes/Tests/ScenePresenceSitTests.cs | 2 +- .../Tests/ScenePresenceTeleportTests.cs | 165 ++++--------- .../Framework/Scenes/Tests/SceneTests.cs | 2 +- .../Scenes/Tests/TaskInventoryTests.cs | 8 +- .../Scenes/Tests/UserInventoryTests.cs | 4 +- .../Scenes/Tests/UuidGathererTests.cs | 2 +- .../XmlRpcGroups/Tests/GroupsModuleTests.cs | 2 +- .../World/NPC/Tests/NPCModuleTests.cs | 2 +- .../Shared/Tests/LSL_ApiInventoryTests.cs | 2 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 4 +- .../Shared/Tests/OSSL_ApiAppearanceTest.cs | 2 +- .../Shared/Tests/OSSL_ApiNpcTests.cs | 2 +- .../ScriptEngine/XEngine/Tests/XEngineTest.cs | 2 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 216 ++++++++++-------- OpenSim/Tests/Common/Mock/TestLandChannel.cs | 17 +- OpenSim/Tests/Torture/NPCTortureTests.cs | 2 +- OpenSim/Tests/Torture/ObjectTortureTests.cs | 2 +- OpenSim/Tests/Torture/ScriptTortureTests.cs | 2 +- 49 files changed, 267 insertions(+), 302 deletions(-) diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index fd152c35d2..85e5cc65f1 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests TestHelpers.InMethod(); // Overkill - we only really need the asset service, not a whole scene. - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService); TestOSHttpRequest req = new TestOSHttpRequest(); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs index a5209b7aec..c25b58cf8f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/Tests/EventQueueTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.ClientStack.Linden.Tests CapabilitiesModule capsModule = new CapabilitiesModule(); EventQueueGetModule eqgModule = new EventQueueGetModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule); } diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs index a575e3616d..1321470c28 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/BasicCircuitTests.cs @@ -158,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests TestHelpers.InMethod(); // XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); uint myCircuitCode = 123456; UUID myAgentUuid = TestHelpers.ParseTail(0x1); UUID mySessionUuid = TestHelpers.ParseTail(0x2); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs index 1b68d68765..221f02bda9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Tests/LLImageManagerTests.cs @@ -79,7 +79,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests J2KDecoderModule j2kdm = new J2KDecoderModule(); - scene = SceneHelpers.SetupScene(); + scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, j2kdm); tc = new TestClient(SceneHelpers.GenerateAgentData(userId), scene); diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 5adb84596c..c91b25fac2 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Asset.Tests config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); m_cache = new FlotsamAssetCache(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_cache); } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index bfe5e4a37f..42d07fd2d6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - scene = SceneHelpers.SetupScene(); + scene = new SceneHelpers().SetupScene(); m_attMod = new AttachmentsModule(); SceneHelpers.SetupSceneModules(scene, config, m_attMod, new BasicInventoryAccessModule()); } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs index 11a0a86bde..848b3bfc08 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/Tests/AvatarFactoryModuleTests.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory UUID userId = TestHelpers.ParseTail(0x1); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, afm); ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); @@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory CoreAssetCache assetCache = new CoreAssetCache(); AvatarFactoryModule afm = new AvatarFactoryModule(); - TestScene scene = SceneHelpers.SetupScene(assetCache); + TestScene scene = new SceneHelpers(assetCache).SetupScene(); SceneHelpers.SetupSceneModules(scene, afm); ScenePresence sp = SceneHelpers.AddScenePresence(scene, userId); diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs index 45b4264c91..7a197f7cd5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/Tests/FriendModuleTests.cs @@ -78,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends.Tests config.AddConfig("FriendsService"); config.Configs["FriendsService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); m_fm = new FriendsModule(); SceneHelpers.SetupSceneModules(m_scene, config, m_fm); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 19ef571e7e..90ae69d6ff 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests // log4net.Config.XmlConfigurator.Configure(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index e409c8e051..b112b6db52 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); m_archiverModule = new InventoryArchiverModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs index 417c20c097..6eb3605235 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs @@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user @@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); @@ -222,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); @@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests InventoryArchiverModule archiverModule = new InventoryArchiverModule(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, archiverModule); // Create user @@ -326,7 +326,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); Dictionary foldersCreated = new Dictionary(); @@ -393,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; @@ -444,7 +444,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene); string folder1ExistingName = "a"; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 0d1b7e445a..eb2e40129d 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -586,7 +586,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected virtual void AgentHasMovedAway(ScenePresence sp, bool logout) { - sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); + if (sp.Scene.AttachmentsModule != null) + sp.Scene.AttachmentsModule.DeleteAttachmentsFromScene(sp, true); } protected void KillEntity(Scene scene, uint localID) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index e74310c849..d6afaa9e75 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_iam); // Create user diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 63f1363729..643c6cfde3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); } @@ -463,7 +463,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - TestScene scene2 = SceneHelpers.SetupScene(); + TestScene scene2 = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is @@ -607,7 +607,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SerialiserModule serialiserModule = new SerialiserModule(); TerrainModule terrainModule = new TerrainModule(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs index e553ffa571..b5ee4d2cae 100644 --- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests { m_pcm = new PrimCountModule(); LandManagementModule lmm = new LandManagementModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, lmm, m_pcm); int xParcelDivider = (int)Constants.RegionSize - 1; diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 4326606d5a..0545250db7 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests public void SetUp() { m_module = new MoapModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, m_module); } diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs index d1d2020587..7825e3e7c7 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs @@ -343,7 +343,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests public void Init() { m_serialiserModule = new SerialiserModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, m_serialiserModule); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fdff8a9ef5..2d4f4839b3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -436,6 +436,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_simulationService == null) m_simulationService = RequestModuleInterface(); + return m_simulationService; } } @@ -3213,7 +3214,7 @@ namespace OpenSim.Region.Framework.Scenes try { m_log.DebugFormat( - "[SCENE]: Removing {0} agent {1} {2} from region {2}", + "[SCENE]: Removing {0} agent {1} {2} from region {3}", (isChildAgent ? "child" : "root"), avatar.Name, agentID, RegionInfo.RegionName); m_sceneGraph.removeUserCount(!isChildAgent); @@ -3875,7 +3876,10 @@ namespace OpenSim.Region.Framework.Scenes ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); if (nearestParcel == null) { - m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID); + m_log.DebugFormat( + "[SCENE]: Denying root agent entry to {0} in {1}: no allowed parcel", + cAgentData.AgentID, RegionInfo.RegionName); + return false; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index a5d2b2304a..ea9fc9386e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { static public Random random; SceneObjectGroup found; - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); [Test] public void T010_AddObjects() diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index 9a60e50eb9..1c33a5f27a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDuplicateObject() { TestHelpers.InMethod(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UUID ownerId = new UUID("00000000-0000-0000-0000-000000000010"); string part1Name = "part1"; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 7737d8ea83..453e077c8a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); int partsToTestCount = 3; SceneObjectGroup so @@ -118,7 +118,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); string obj1Name = "Alfred"; string obj2Name = "Betty"; @@ -152,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); int partsToTestCount = 3; SceneObjectGroup so @@ -185,7 +185,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); SceneObjectPart part = SceneHelpers.AddSceneObject(scene); scene.DeleteSceneObject(part.ParentGroup, false); @@ -204,7 +204,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 654b1a2cc6..0076f41225 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); @@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index be5b4a8986..1add3ddb8c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID ownerId = TestHelpers.ParseTail(0x1); int nParts = 3; - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10); scene.AddSceneObject(sog1); scene.LinkObjects(ownerId, sog1.LocalId, new List() { sog1.Parts[1].LocalId }); @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); @@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); SceneObjectGroup grp1 = part1.ParentGroup; SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); @@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); @@ -325,7 +325,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index b49c6e7a98..0a94c1900d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; g1.GroupResize(new Vector3(2, 3, 4)); @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); g1.RootPart.Scale = new Vector3(2, 3, 4); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index c582cf66fb..d2361f8667 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // UUID itemId = TestHelpers.ParseTail(0x2); string itemName = "Test Script Item"; - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, userId); scene.AddNewSceneObject(so, true); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index 9fea3c63a7..6d255aa2d9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [SetUp] public void SetUp() { - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 18ebd33fe0..00b447781b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -26,6 +26,7 @@ */ using System; +using System.Collections.Generic; using System.Reflection; using NUnit.Framework; using OpenMetaverse; @@ -44,13 +45,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests public class SceneObjectStatusTests { private TestScene m_scene; + private UUID m_ownerId = TestHelpers.ParseTail(0x1); private SceneObjectGroup m_so1; + private SceneObjectGroup m_so2; [SetUp] public void Init() { - m_scene = SceneHelpers.SetupScene(); - SceneObjectGroup m_so1 = SceneHelpers.CreateSceneObject(1, UUID.Zero); + m_scene = new SceneHelpers().SetupScene(); + m_so1 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so1", 0x10); + m_so2 = SceneHelpers.CreateSceneObject(1, m_ownerId, "so2", 0x20); } [Test] @@ -94,7 +98,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests /// /// Test that linking results in the correct physical status for all linkees. /// - [Test] +// [Test] public void TestLinkPhysicsChildPhysicalOnly() { TestHelpers.InMethod(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index c13d82e16d..c7eaff9d00 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig startupConfig = configSource.AddConfig("Startup"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index ed9b179286..2e46377901 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -67,10 +67,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void Init() { TestHelpers.InMethod(); - - scene = SceneHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); - scene2 = SceneHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); - scene3 = SceneHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); + + SceneHelpers sh = new SceneHelpers(); + + scene = sh.SetupScene("Neighbour x", UUID.Random(), 1000, 1000); + scene2 = sh.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000); + scene3 = sh.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000); ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); interregionComms.Initialise(new IniConfigSource()); @@ -101,7 +103,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Not.Null); @@ -126,7 +128,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests IConfig config = configSource.AddConfig("Modules"); config.Set("SimulationServices", "LocalSimulationConnectorModule"); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, configSource, lsc); UUID agentId = TestHelpers.ParseTail(0x01); @@ -176,8 +178,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); - TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); + TestScene myScene1 = new SceneHelpers().SetupScene("Neighbour y", UUID.Random(), 1000, 1000); + TestScene myScene2 = new SceneHelpers().SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 89f8007d0f..646e5fa61a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); sp.Flying = true; sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index cfea10d710..1d1ff88420 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [SetUp] public void Init() { - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); } [Test] diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index b7b8db445e..313e350cbc 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [SetUp] public void Init() { - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1)); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index eb7bfbd802..19542ffffe 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Not strictly necessary since FriendsModule assumes it is the default (!) config.Configs["Modules"].Set("EntityTransferModule", etm.Name); - TestScene scene = SceneHelpers.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); + TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); SceneHelpers.SetupSceneModules(scene, config, etm); Vector3 teleportPosition = new Vector3(10, 11, 12); @@ -83,145 +83,58 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } - /// - /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. - /// - /// Does not yet do what is says on the tin. - /// Commenting for now - //[Test, LongRunning] - public void TestSimpleNotNeighboursTeleport() + [Test] + public void TestSameSimulatorSeparatedRegionsTeleport() { TestHelpers.InMethod(); - ThreadRunResults results = new ThreadRunResults(); - results.Result = false; - results.Message = "Test did not run"; - TestRunning testClass = new TestRunning(results); +// log4net.Config.XmlConfigurator.Configure(); - Thread testThread = new Thread(testClass.run); + UUID userId = TestHelpers.ParseTail(0x1); - // Seems kind of redundant to start a thread and then join it, however.. We need to protect against - // A thread abort exception in the simulator code. - testThread.Start(); - testThread.Join(); + EntityTransferModule etm = new EntityTransferModule(); + LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); - Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); - // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); - } + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + // Not strictly necessary since FriendsModule assumes it is the default (!) + config.Configs["Modules"].Set("EntityTransferModule", etm.Name); + config.Configs["Modules"].Set("SimulationServices", lscm.Name); - [TearDown] - public void TearDown() - { - try - { - if (MainServer.Instance != null) MainServer.Instance.Stop(); - } - catch (NullReferenceException) - { } - } + SceneHelpers sh = new SceneHelpers(); + TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); + TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); - } + SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm); - public class ThreadRunResults - { - public bool Result = false; - public string Message = string.Empty; - } + Vector3 teleportPosition = new Vector3(10, 11, 12); + Vector3 teleportLookAt = new Vector3(20, 21, 22); - public class TestRunning - { - public ThreadRunResults results; - public TestRunning(ThreadRunResults t) - { - results = t; - } - public void run(object o) - { - - //results.Result = true; - log4net.Config.XmlConfigurator.Configure(); + ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); + sp.AbsolutePosition = new Vector3(30, 31, 32); - UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); - UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); + // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole + // UDP stack (?) + ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; - // shared module - ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); + sceneA.RequestTeleportLocation( + sp.ControllingClient, + sceneB.RegionInfo.RegionHandle, + teleportPosition, + teleportLookAt, + (uint)TeleportFlags.ViaLocation); + Assert.That(sceneA.GetScenePresence(userId), Is.Null); - Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); - SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); - sceneB.RegisterRegionWithGrid(); + ScenePresence sceneBSp = sceneB.GetScenePresence(userId); + Assert.That(sceneBSp, Is.Not.Null); + Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); + Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); - Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); - SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); - sceneA.RegisterRegionWithGrid(); + // TODO: Add assertions to check correct circuit details in both scenes. - UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); - TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; - - ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface(); - - results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); - - if (!results.Result) - { - results.Message = "Incorrect caps object path set up in sceneA"; - return; - } - - /* - Assert.That( - sceneACapsModule.GetCapsPath(agentId), - Is.EqualTo(client.CapsSeedUrl), - "Incorrect caps object path set up in sceneA"); - */ - // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. - - - client.TeleportTargetScene = sceneB; - client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); - - results.Result = (sceneB.GetScenePresence(agentId) != null); - if (!results.Result) - { - results.Message = "Client does not have an agent in sceneB"; - return; - } - - //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); - - //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); - - results.Result = (sceneA.GetScenePresence(agentId) == null); - if (!results.Result) - { - results.Message = "Client still had an agent in sceneA"; - return; - } - - ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface(); - - - results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + - "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); - if (!results.Result) - { - results.Message = "Incorrect caps object path set up in sceneB"; - return; - } - - // Temporary assertion - caps url construction should at least be doable through a method. - /* - Assert.That( - "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", - Is.EqualTo(client.CapsSeedUrl), - "Incorrect caps object path set up in sceneB"); - */ - // This assertion will currently fail since we don't remove the caps paths when no longer needed - //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); - - // TODO: Check that more of everything is as it should be - - // TODO: test what happens if we try to teleport to a region that doesn't exist + // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera + // position instead). +// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 5c9a77db67..d722a0990a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); scene.Update(1); Assert.That(scene.Frame, Is.EqualTo(1)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index f946b00f9a..7ec33553b9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; @@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; @@ -154,7 +154,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 55fc1e73f8..44d2d452d5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "item1", user1.PrincipalID); @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); InventoryFolderBase folder1 diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index d9fe87c0bf..198e487d1b 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void Init() { // FIXME: We don't need a full scene here - it would be enough to set up the asset service. - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); m_assetService = scene.AssetService; m_uuidGatherer = new UuidGatherer(m_assetService); } diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index d2f63272bd..ac638f1053 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Groups"); config.Set("Enabled", true); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index eea0b2e6ad..a39257e1d0 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); } diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs index e2d0db267f..49266e91ea 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, initConfigSource); m_engine = new XEngine.XEngine(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index 9cf9258571..92a63bf497 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); SceneObjectPart part = SceneHelpers.AddSceneObject(scene); XEngine.XEngine engine = new XEngine.XEngine(); @@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests TestHelpers.InMethod(); // Create Prim1. - Scene scene = SceneHelpers.SetupScene(); + Scene scene = new SceneHelpers().SetupScene(); string obj1Name = "Prim1"; UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001"); SceneObjectPart part1 = diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs index 7573dfff5f..c51227b77c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs @@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests config = initConfigSource.AddConfig("NPC"); config.Set("Enabled", "true"); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); m_engine = new XEngine.XEngine(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 9d9fc514a3..9c36108da3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests config = initConfigSource.AddConfig("NPC"); config.Set("Enabled", "true"); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule()); m_engine = new XEngine.XEngine(); diff --git a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs index 7d7bd82778..a3f848cfd4 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/Tests/XEngineTest.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine.Tests // to AssemblyResolver.OnAssemblyResolve fails. xEngineConfig.Set("AppDomainLoading", "false"); - m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource); + m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); m_scene.StartScripts(); } diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 7a6b1cf8d5..8e547077fc 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -58,57 +58,67 @@ namespace OpenSim.Tests.Common /// public class SceneHelpers { - public static TestScene SetupScene() + private AgentCircuitManager m_acm = new AgentCircuitManager(); + private ISimulationDataService m_simDataService + = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); + private IEstateDataService m_estateDataService; + + private LocalAssetServicesConnector m_assetService; + private LocalAuthenticationServicesConnector m_authenticationService; + private LocalInventoryServicesConnector m_inventoryService; + private LocalGridServicesConnector m_gridService; + private LocalUserAccountServicesConnector m_userAccountService; + private LocalPresenceServicesConnector m_presenceService; + + private CoreAssetCache m_cache; + + public SceneHelpers() : this(null) {} + + public SceneHelpers(CoreAssetCache cache) { - return SetupScene(null); + m_assetService = StartAssetService(cache); + m_authenticationService = StartAuthenticationService(); + m_inventoryService = StartInventoryService(); + m_gridService = StartGridService(); + m_userAccountService = StartUserAccountService(); + m_presenceService = StartPresenceService(); + + m_inventoryService.PostInitialise(); + m_assetService.PostInitialise(); + m_userAccountService.PostInitialise(); + m_presenceService.PostInitialise(); + + m_cache = cache; } /// /// Set up a test scene /// /// - /// Automatically starts service threads, as would the normal runtime. + /// Automatically starts services, as would the normal runtime. /// /// - public static TestScene SetupScene(CoreAssetCache cache) + public TestScene SetupScene() { - return SetupScene("Unit test region", UUID.Random(), 1000, 1000, cache); + return SetupScene("Unit test region", UUID.Random(), 1000, 1000); } - public static TestScene SetupScene(string name, UUID id, uint x, uint y) + public TestScene SetupScene(string name, UUID id, uint x, uint y) { - return SetupScene(name, id, x, y, null); + return SetupScene(name, id, x, y, new IniConfigSource()); } /// - /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions - /// or a different, to get a brand new scene with new shared region modules. + /// Set up a scene. /// /// Name of the region /// ID of the region /// X co-ordinate of the region /// Y co-ordinate of the region - /// - /// - public static TestScene SetupScene( - string name, UUID id, uint x, uint y, CoreAssetCache cache) - { - return SetupScene(name, id, x, y, cache, new IniConfigSource()); - } - - /// - /// Set up a scene. If it's more then one scene, use the same CommunicationsManager to link regions - /// or a different, to get a brand new scene with new shared region modules. - /// - /// Name of the region - /// ID of the region - /// X co-ordinate of the region - /// Y co-ordinate of the region - /// /// /// - public static TestScene SetupScene( - string name, UUID id, uint x, uint y, CoreAssetCache cache, IConfigSource configSource) + public TestScene SetupScene( + string name, UUID id, uint x, uint y, IConfigSource configSource) { Console.WriteLine("Setting up test scene {0}", name); @@ -119,30 +129,47 @@ namespace OpenSim.Tests.Common regInfo.RegionName = name; regInfo.RegionID = id; - AgentCircuitManager acm = new AgentCircuitManager(); SceneCommunicationService scs = new SceneCommunicationService(); - ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); - IEstateDataService estateDataService = null; - TestScene testScene = new TestScene( - regInfo, acm, scs, simDataService, estateDataService, null, false, configSource, null); + regInfo, m_acm, scs, m_simDataService, m_estateDataService, null, false, configSource, null); IRegionModule godsModule = new GodsModule(); godsModule.Initialise(testScene, new IniConfigSource()); testScene.AddModule(godsModule.Name, godsModule); - LocalAssetServicesConnector assetService = StartAssetService(testScene, cache); - StartAuthenticationService(testScene); - LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene); - StartGridService(testScene); - LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene); - LocalPresenceServicesConnector presenceService = StartPresenceService(testScene); + // Add scene to services + m_assetService.AddRegion(testScene); - inventoryService.PostInitialise(); - assetService.PostInitialise(); - userAccountService.PostInitialise(); - presenceService.PostInitialise(); + if (m_cache != null) + { + m_cache.AddRegion(testScene); + m_cache.RegionLoaded(testScene); + testScene.AddRegionModule(m_cache.Name, m_cache); + } + + m_assetService.RegionLoaded(testScene); + testScene.AddRegionModule(m_assetService.Name, m_assetService); + + m_authenticationService.AddRegion(testScene); + m_authenticationService.RegionLoaded(testScene); + testScene.AddRegionModule(m_authenticationService.Name, m_authenticationService); + + m_inventoryService.AddRegion(testScene); + m_inventoryService.RegionLoaded(testScene); + testScene.AddRegionModule(m_inventoryService.Name, m_inventoryService); + + m_gridService.AddRegion(testScene); + m_gridService.RegionLoaded(testScene); + testScene.AddRegionModule(m_gridService.Name, m_gridService); + + m_userAccountService.AddRegion(testScene); + m_userAccountService.RegionLoaded(testScene); + testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); + + m_presenceService.AddRegion(testScene); + m_presenceService.RegionLoaded(testScene); + testScene.AddRegionModule(m_presenceService.Name, m_presenceService); testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.SetModuleInterfaces(); @@ -162,19 +189,17 @@ namespace OpenSim.Tests.Common return testScene; } - private static LocalAssetServicesConnector StartAssetService(Scene testScene, CoreAssetCache cache) + private static LocalAssetServicesConnector StartAssetService(CoreAssetCache cache) { - LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); config.AddConfig("AssetService"); config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - + + LocalAssetServicesConnector assetService = new LocalAssetServicesConnector(); assetService.Initialise(config); - assetService.AddRegion(testScene); if (cache != null) { @@ -184,56 +209,43 @@ namespace OpenSim.Tests.Common cacheConfig.AddConfig("AssetCache"); cache.Initialise(cacheConfig); - cache.AddRegion(testScene); - cache.RegionLoaded(testScene); - testScene.AddRegionModule(cache.Name, cache); } - - assetService.RegionLoaded(testScene); - testScene.AddRegionModule(assetService.Name, assetService); return assetService; } - private static void StartAuthenticationService(Scene testScene) + private static LocalAuthenticationServicesConnector StartAuthenticationService() { - ISharedRegionModule service = new LocalAuthenticationServicesConnector(); IConfigSource config = new IniConfigSource(); - config.AddConfig("Modules"); config.AddConfig("AuthenticationService"); config.Configs["Modules"].Set("AuthenticationServices", "LocalAuthenticationServicesConnector"); config.Configs["AuthenticationService"].Set( "LocalServiceModule", "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"); config.Configs["AuthenticationService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); - + + LocalAuthenticationServicesConnector service = new LocalAuthenticationServicesConnector(); service.Initialise(config); - service.AddRegion(testScene); - service.RegionLoaded(testScene); - testScene.AddRegionModule(service.Name, service); - //m_authenticationService = service; + + return service; } - private static LocalInventoryServicesConnector StartInventoryService(Scene testScene) + private static LocalInventoryServicesConnector StartInventoryService() { - LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); - IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); config.AddConfig("InventoryService"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); - + + LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector(); inventoryService.Initialise(config); - inventoryService.AddRegion(testScene); - inventoryService.RegionLoaded(testScene); - testScene.AddRegionModule(inventoryService.Name, inventoryService); return inventoryService; } - private static LocalGridServicesConnector StartGridService(Scene testScene) + private static LocalGridServicesConnector StartGridService() { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -245,8 +257,6 @@ namespace OpenSim.Tests.Common LocalGridServicesConnector gridService = new LocalGridServicesConnector(); gridService.Initialise(config); - gridService.AddRegion(testScene); - gridService.RegionLoaded(testScene); return gridService; } @@ -256,7 +266,7 @@ namespace OpenSim.Tests.Common /// /// /// - private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene) + private static LocalUserAccountServicesConnector StartUserAccountService() { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -268,10 +278,6 @@ namespace OpenSim.Tests.Common LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector(); userAccountService.Initialise(config); - - userAccountService.AddRegion(testScene); - userAccountService.RegionLoaded(testScene); - testScene.AddRegionModule(userAccountService.Name, userAccountService); return userAccountService; } @@ -280,7 +286,7 @@ namespace OpenSim.Tests.Common /// Start a presence service /// /// - private static LocalPresenceServicesConnector StartPresenceService(Scene testScene) + private static LocalPresenceServicesConnector StartPresenceService() { IConfigSource config = new IniConfigSource(); config.AddConfig("Modules"); @@ -292,10 +298,6 @@ namespace OpenSim.Tests.Common LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector(); presenceService.Initialise(config); - - presenceService.AddRegion(testScene); - presenceService.RegionLoaded(testScene); - testScene.AddRegionModule(presenceService.Name, presenceService); return presenceService; } @@ -313,10 +315,37 @@ namespace OpenSim.Tests.Common /// /// Setup modules for a scene. /// - /// + /// + /// If called directly, then all the modules must be shared modules. + /// + /// /// /// public static void SetupSceneModules(Scene scene, IConfigSource config, params object[] modules) + { + SetupSceneModules(new Scene[] { scene }, config, modules); + } + + /// + /// Setup modules for a scene using their default settings. + /// + /// + /// + public static void SetupSceneModules(Scene[] scenes, params object[] modules) + { + SetupSceneModules(scenes, new IniConfigSource(), modules); + } + + /// + /// Setup modules for scenes. + /// + /// + /// If called directly, then all the modules must be shared modules. + /// + /// + /// + /// + public static void SetupSceneModules(Scene[] scenes, IConfigSource config, params object[] modules) { List newModules = new List(); foreach (object module in modules) @@ -324,8 +353,13 @@ namespace OpenSim.Tests.Common if (module is IRegionModule) { IRegionModule m = (IRegionModule)module; - m.Initialise(scene, config); - scene.AddModule(m.Name, m); + + foreach (Scene scene in scenes) + { + m.Initialise(scene, config); + scene.AddModule(m.Name, m); + } + m.PostInitialise(); } else if (module is IRegionModuleBase) @@ -345,15 +379,19 @@ namespace OpenSim.Tests.Common foreach (IRegionModuleBase module in newModules) { - module.AddRegion(scene); - scene.AddRegionModule(module.Name, module); + foreach (Scene scene in scenes) + { + module.AddRegion(scene); + scene.AddRegionModule(module.Name, module); + } } // RegionLoaded is fired after all modules have been appropriately added to all scenes foreach (IRegionModuleBase module in newModules) - module.RegionLoaded(scene); + foreach (Scene scene in scenes) + module.RegionLoaded(scene); - scene.SetModuleInterfaces(); + foreach (Scene scene in scenes) { scene.SetModuleInterfaces(); } } /// diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 0e4dfb9eee..4b4d52d77e 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs @@ -46,6 +46,14 @@ namespace OpenSim.Tests.Common.Mock { m_scene = scene; m_parcels = new List(); + SetupDefaultParcel(); + } + + private void SetupDefaultParcel() + { + ILandObject obj = new LandObject(UUID.Zero, false, m_scene); + obj.LandData.Name = "Your Parcel"; + m_parcels.Add(obj); } public List ParcelsNearPoint(Vector3 position) @@ -63,11 +71,7 @@ namespace OpenSim.Tests.Common.Mock m_parcels.Clear(); if (setupDefaultParcel) - { - ILandObject obj = new LandObject(UUID.Zero, false, m_scene); - obj.LandData.Name = "Your Parcel"; - m_parcels.Add(obj); - } + SetupDefaultParcel(); } protected ILandObject GetNoLand() @@ -102,6 +106,5 @@ namespace OpenSim.Tests.Common.Mock public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} - } -} +} \ No newline at end of file diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Torture/NPCTortureTests.cs index 02245056c4..731df6808c 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Torture/NPCTortureTests.cs @@ -98,7 +98,7 @@ namespace OpenSim.Tests.Torture umm = new UserManagementModule(); am = new AttachmentsModule(); - scene = SceneHelpers.SetupScene(); + scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(scene, config, afm, umm, am, new BasicInventoryAccessModule(), new NPCModule()); } diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Torture/ObjectTortureTests.cs index d0d2199b0c..195d47bd52 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Torture/ObjectTortureTests.cs @@ -126,7 +126,7 @@ namespace OpenSim.Tests.Torture // Using a local variable for scene, at least on mono 2.6.7, means that it's much more likely to be garbage // collected when we teardown this test. If it's done in a member variable, even if that is subsequently // nulled out, the garbage collect can be delayed. - TestScene scene = SceneHelpers.SetupScene(); + TestScene scene = new SceneHelpers().SetupScene(); // Process process = Process.GetCurrentProcess(); // long startProcessMemory = process.PrivateMemorySize64; diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Torture/ScriptTortureTests.cs index 2ef55b34b3..24f278f3f8 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Torture/ScriptTortureTests.cs @@ -84,7 +84,7 @@ namespace OpenSim.Tests.Torture // to AssemblyResolver.OnAssemblyResolve fails. xEngineConfig.Set("AppDomainLoading", "false"); - m_scene = SceneHelpers.SetupScene("My Test", UUID.Random(), 1000, 1000, null, configSource); + m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource); SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule); m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;