diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index a9a9ecd..3c4049d 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Net; | ||
28 | using Nini.Config; | 29 | using Nini.Config; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
@@ -32,6 +33,7 @@ using OpenSim.Framework.Communications; | |||
32 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
34 | using OpenSim.Region.Physics.Manager; | 35 | using OpenSim.Region.Physics.Manager; |
36 | using OpenSim.Region.Environment; | ||
35 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
37 | 39 | ||
@@ -48,18 +50,31 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
48 | /// <returns></returns> | 50 | /// <returns></returns> |
49 | public static TestScene SetupScene() | 51 | public static TestScene SetupScene() |
50 | { | 52 | { |
51 | RegionInfo regInfo = new RegionInfo(1000, 1000, null, null); | 53 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); |
52 | regInfo.RegionName = "Unit test region"; | 54 | } |
53 | regInfo.ExternalHostName = "1.2.3.4"; | 55 | |
56 | /// <summary> | ||
57 | /// Set up a test scene | ||
58 | /// </summary> | ||
59 | /// <param name="name">Name of the region</param> | ||
60 | /// <param name="id">ID of the region</param> | ||
61 | /// <param name="x">X co-ordinate of the region</param> | ||
62 | /// <param name="y">Y co-ordinate of the region</param> | ||
63 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | ||
64 | /// <returns></returns> | ||
65 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, CommunicationsManager cm) | ||
66 | { | ||
67 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | ||
68 | regInfo.RegionName = name; | ||
69 | regInfo.RegionID = id; | ||
54 | 70 | ||
55 | AgentCircuitManager acm = new AgentCircuitManager(); | 71 | AgentCircuitManager acm = new AgentCircuitManager(); |
56 | CommunicationsManager cm = new TestCommunicationsManager(); | ||
57 | SceneCommunicationService scs = new SceneCommunicationService(cm); | 72 | SceneCommunicationService scs = new SceneCommunicationService(cm); |
58 | 73 | ||
59 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); | 74 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); |
60 | AssetCache ac = new AssetCache(assetService); | 75 | AssetCache ac = new AssetCache(assetService); |
61 | 76 | ||
62 | StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); | 77 | StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); |
63 | IConfigSource configSource = new IniConfigSource(); | 78 | IConfigSource configSource = new IniConfigSource(); |
64 | 79 | ||
65 | TestScene testScene = new TestScene( | 80 | TestScene testScene = new TestScene( |
@@ -70,7 +85,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
70 | 85 | ||
71 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | 86 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); |
72 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | 87 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); |
73 | testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | 88 | testScene.PhysicsScene |
89 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
74 | 90 | ||
75 | return testScene; | 91 | return testScene; |
76 | } | 92 | } |
@@ -81,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
81 | /// <param name="scene"></param> | 97 | /// <param name="scene"></param> |
82 | /// <param name="agentId"></param> | 98 | /// <param name="agentId"></param> |
83 | /// <returns></returns> | 99 | /// <returns></returns> |
84 | public static IClientAPI AddRootAgent(Scene scene, UUID agentId) | 100 | public static TestClient AddRootAgent(Scene scene, UUID agentId) |
85 | { | 101 | { |
86 | string firstName = "testfirstname"; | 102 | string firstName = "testfirstname"; |
87 | 103 | ||
@@ -102,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
102 | scene.NewUserConnection(agent); | 118 | scene.NewUserConnection(agent); |
103 | 119 | ||
104 | // Stage 2: add the new client as a child agent to the scene | 120 | // Stage 2: add the new client as a child agent to the scene |
105 | IClientAPI client = new TestClient(agent); | 121 | TestClient client = new TestClient(agent); |
106 | scene.AddNewClient(client); | 122 | scene.AddNewClient(client); |
107 | 123 | ||
108 | // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, | 124 | // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, |