From f8aea3724da138107fc4121254e5eeea5f178aa0 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 23 Jan 2009 17:55:29 +0000 Subject: refactor: move test modules set up code to common function --- .../Environment/Scenes/Tests/StandaloneTeleportTests.cs | 12 +++--------- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs index f1ad508..0c7de74 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs @@ -61,18 +61,12 @@ namespace OpenSim.Region.Environment.Scenes.Tests // shared module IRegionModule interregionComms = new RESTInterregionComms(); - // TODO: Clean this up - Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); - interregionComms.Initialise(sceneA, new IniConfigSource()); - sceneA.AddModule(interregionComms.Name, interregionComms); - sceneA.SetModuleInterfaces(); + Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); + SceneSetupHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); sceneA.RegisterRegionWithGrid(); - // TODO: Clean this up Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); - interregionComms.Initialise(sceneB, new IniConfigSource()); - sceneB.AddModule(interregionComms.Name, interregionComms); - sceneB.SetModuleInterfaces(); + SceneSetupHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); sceneB.RegisterRegionWithGrid(); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 11ebc86..74f177a 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -99,6 +99,23 @@ namespace OpenSim.Tests.Common.Setup } /// + /// Setup the given modules for a given scene. + /// + /// + /// + /// + public static void SetupSceneModules(Scene scene, IConfigSource config, params IRegionModule[] modules) + { + foreach (IRegionModule module in modules) + { + module.Initialise(scene, config); + scene.AddModule(module.Name, module); + } + + scene.SetModuleInterfaces(); + } + + /// /// Generate some standard agent connection data. /// /// -- cgit v1.1