diff options
author | Justin Clarke Casey | 2009-01-23 17:32:38 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-23 17:32:38 +0000 |
commit | ee3c61247e61d03ee252f373144d5c6bfecb9d6f (patch) | |
tree | 2ef31475b79dcfdcf034e3ff3404425ac8aecb15 /OpenSim/Region/Environment | |
parent | * minor: remove serialization and deserializationg sog log messages for now (diff) | |
download | opensim-SC-ee3c61247e61d03ee252f373144d5c6bfecb9d6f.zip opensim-SC-ee3c61247e61d03ee252f373144d5c6bfecb9d6f.tar.gz opensim-SC-ee3c61247e61d03ee252f373144d5c6bfecb9d6f.tar.bz2 opensim-SC-ee3c61247e61d03ee252f373144d5c6bfecb9d6f.tar.xz |
* refactor: move scene setup code into common test code assembly
Diffstat (limited to 'OpenSim/Region/Environment')
5 files changed, 30 insertions, 253 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs index cc9cc03..0155966 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs | |||
@@ -36,18 +36,16 @@ using OpenMetaverse; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
38 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
39 | using OpenSim.Tests.Common.Setup; | ||
39 | 40 | ||
40 | namespace OpenSim.Region.Environment.Scenes.Tests | 41 | namespace OpenSim.Region.Environment.Scenes.Tests |
41 | { | 42 | { |
42 | /// <summary> | ||
43 | /// Scene oriented tests | ||
44 | /// </summary> | ||
45 | [TestFixture] | 43 | [TestFixture] |
46 | public class EntityManagerTests | 44 | public class EntityManagerTests |
47 | { | 45 | { |
48 | static public Random random; | 46 | static public Random random; |
49 | SceneObjectGroup found; | 47 | SceneObjectGroup found; |
50 | Scene scene = SceneTestUtils.SetupScene(); | 48 | Scene scene = SceneSetupHelpers.SetupScene(); |
51 | 49 | ||
52 | [Test] | 50 | [Test] |
53 | public void T010_AddObjects() | 51 | public void T010_AddObjects() |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs index e347e67..ae879bb 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework.Communications.Cache; | |||
35 | using OpenSim.Region.Communications.Local; | 35 | using OpenSim.Region.Communications.Local; |
36 | using OpenSim.Region.Environment.Scenes; | 36 | using OpenSim.Region.Environment.Scenes; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | using OpenSim.Tests.Common.Setup; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Environment.Scenes.Tests | 40 | namespace OpenSim.Region.Environment.Scenes.Tests |
40 | { | 41 | { |
@@ -50,8 +51,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
50 | [Test] | 51 | [Test] |
51 | public void TestAddSceneObject() | 52 | public void TestAddSceneObject() |
52 | { | 53 | { |
53 | Scene scene = SceneTestUtils.SetupScene(); | 54 | Scene scene = SceneSetupHelpers.SetupScene(); |
54 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); | 55 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); |
55 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 56 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
56 | 57 | ||
57 | //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); | 58 | //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); |
@@ -65,8 +66,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
65 | [Test] | 66 | [Test] |
66 | public void TestDeleteSceneObject() | 67 | public void TestDeleteSceneObject() |
67 | { | 68 | { |
68 | TestScene scene = SceneTestUtils.SetupScene(); | 69 | TestScene scene = SceneSetupHelpers.SetupScene(); |
69 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); | 70 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); |
70 | scene.DeleteSceneObject(part.ParentGroup, false); | 71 | scene.DeleteSceneObject(part.ParentGroup, false); |
71 | 72 | ||
72 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 73 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
@@ -81,15 +82,15 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
81 | { | 82 | { |
82 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 83 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
83 | 84 | ||
84 | TestScene scene = SceneTestUtils.SetupScene(); | 85 | TestScene scene = SceneSetupHelpers.SetupScene(); |
85 | 86 | ||
86 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | 87 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. |
87 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | 88 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
88 | sogd.Enabled = false; | 89 | sogd.Enabled = false; |
89 | 90 | ||
90 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); | 91 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); |
91 | 92 | ||
92 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); | 93 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); |
93 | scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); | 94 | scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); |
94 | 95 | ||
95 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 96 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); |
@@ -105,10 +106,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
105 | { | 106 | { |
106 | bool debugtest = false; | 107 | bool debugtest = false; |
107 | 108 | ||
108 | Scene scene = SceneTestUtils.SetupScene(); | 109 | Scene scene = SceneSetupHelpers.SetupScene(); |
109 | SceneObjectPart part1 = SceneTestUtils.AddSceneObject(scene); | 110 | SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); |
110 | SceneObjectGroup grp1 = part1.ParentGroup; | 111 | SceneObjectGroup grp1 = part1.ParentGroup; |
111 | SceneObjectPart part2 = SceneTestUtils.AddSceneObject(scene); | 112 | SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); |
112 | SceneObjectGroup grp2 = part2.ParentGroup; | 113 | SceneObjectGroup grp2 = part2.ParentGroup; |
113 | 114 | ||
114 | 115 | ||
@@ -178,14 +179,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
178 | { | 179 | { |
179 | bool debugtest = false; | 180 | bool debugtest = false; |
180 | 181 | ||
181 | Scene scene = SceneTestUtils.SetupScene(); | 182 | Scene scene = SceneSetupHelpers.SetupScene(); |
182 | SceneObjectPart part1 = SceneTestUtils.AddSceneObject(scene); | 183 | SceneObjectPart part1 = SceneSetupHelpers.AddSceneObject(scene); |
183 | SceneObjectGroup grp1 = part1.ParentGroup; | 184 | SceneObjectGroup grp1 = part1.ParentGroup; |
184 | SceneObjectPart part2 = SceneTestUtils.AddSceneObject(scene); | 185 | SceneObjectPart part2 = SceneSetupHelpers.AddSceneObject(scene); |
185 | SceneObjectGroup grp2 = part2.ParentGroup; | 186 | SceneObjectGroup grp2 = part2.ParentGroup; |
186 | SceneObjectPart part3 = SceneTestUtils.AddSceneObject(scene); | 187 | SceneObjectPart part3 = SceneSetupHelpers.AddSceneObject(scene); |
187 | SceneObjectGroup grp3 = part3.ParentGroup; | 188 | SceneObjectGroup grp3 = part3.ParentGroup; |
188 | SceneObjectPart part4 = SceneTestUtils.AddSceneObject(scene); | 189 | SceneObjectPart part4 = SceneSetupHelpers.AddSceneObject(scene); |
189 | SceneObjectGroup grp4 = part4.ParentGroup; | 190 | SceneObjectGroup grp4 = part4.ParentGroup; |
190 | 191 | ||
191 | 192 | ||
@@ -310,21 +311,21 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
310 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 311 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
311 | string myObjectName = "Fred"; | 312 | string myObjectName = "Fred"; |
312 | 313 | ||
313 | TestScene scene = SceneTestUtils.SetupScene(); | 314 | TestScene scene = SceneSetupHelpers.SetupScene(); |
314 | SceneObjectPart part = SceneTestUtils.AddSceneObject(scene, myObjectName); | 315 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); |
315 | 316 | ||
316 | Assert.That( | 317 | Assert.That( |
317 | scene.CommsManager.UserAdminService.AddUser( | 318 | scene.CommsManager.UserAdminService.AddUser( |
318 | "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | 319 | "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), |
319 | Is.EqualTo(agentId)); | 320 | Is.EqualTo(agentId)); |
320 | 321 | ||
321 | IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); | 322 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); |
322 | 323 | ||
323 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | 324 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); |
324 | Assert.That(userInfo, Is.Not.Null); | 325 | Assert.That(userInfo, Is.Not.Null); |
325 | Assert.That(userInfo.RootFolder, Is.Not.Null); | 326 | Assert.That(userInfo.RootFolder, Is.Not.Null); |
326 | 327 | ||
327 | SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | 328 | SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); |
328 | 329 | ||
329 | // Check that we now have the taken part in our inventory | 330 | // Check that we now have the taken part in our inventory |
330 | Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); | 331 | Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index 5ce78a3..5649b16 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -31,6 +31,7 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Environment.Scenes; | 32 | using OpenSim.Region.Environment.Scenes; |
33 | using OpenSim.Tests.Common.Mock; | 33 | using OpenSim.Tests.Common.Mock; |
34 | using OpenSim.Tests.Common.Setup; | ||
34 | 35 | ||
35 | namespace OpenSim.Region.Environment.Scenes.Tests | 36 | namespace OpenSim.Region.Environment.Scenes.Tests |
36 | { | 37 | { |
@@ -46,7 +47,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
46 | [Test] | 47 | [Test] |
47 | public void TestAddRootAgent() | 48 | public void TestAddRootAgent() |
48 | { | 49 | { |
49 | Scene scene = SceneTestUtils.SetupScene(); | 50 | Scene scene = SceneSetupHelpers.SetupScene(); |
50 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 51 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
51 | string firstName = "testfirstname"; | 52 | string firstName = "testfirstname"; |
52 | 53 | ||
@@ -77,10 +78,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
77 | [Test] | 78 | [Test] |
78 | public void TestRemoveRootAgent() | 79 | public void TestRemoveRootAgent() |
79 | { | 80 | { |
80 | Scene scene = SceneTestUtils.SetupScene(); | 81 | Scene scene = SceneSetupHelpers.SetupScene(); |
81 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 82 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
82 | 83 | ||
83 | SceneTestUtils.AddRootAgent(scene, agentId); | 84 | SceneSetupHelpers.AddRootAgent(scene, agentId); |
84 | 85 | ||
85 | scene.RemoveClient(agentId); | 86 | scene.RemoveClient(agentId); |
86 | 87 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs deleted file mode 100644 index 6fa918a..0000000 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ /dev/null | |||
@@ -1,224 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Net; | ||
29 | using Nini.Config; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework.Communications; | ||
33 | using OpenSim.Framework.Communications.Cache; | ||
34 | using OpenSim.Framework.Servers; | ||
35 | using OpenSim.Region.Physics.Manager; | ||
36 | using OpenSim.Region.Environment; | ||
37 | using OpenSim.Region.Environment.Interfaces; | ||
38 | using OpenSim.Region.Environment.Modules.Agent.Capabilities; | ||
39 | using OpenSim.Region.Environment.Scenes; | ||
40 | using OpenSim.Tests.Common.Mock; | ||
41 | |||
42 | namespace OpenSim.Region.Environment.Scenes.Tests | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// Utilities for constructing and performing operations upon scenes. | ||
46 | /// </summary> | ||
47 | public class SceneTestUtils | ||
48 | { | ||
49 | /// <summary> | ||
50 | /// Set up a test scene | ||
51 | /// </summary> | ||
52 | /// <returns></returns> | ||
53 | public static TestScene SetupScene() | ||
54 | { | ||
55 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); | ||
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Set up a test scene | ||
60 | /// </summary> | ||
61 | /// <param name="name">Name of the region</param> | ||
62 | /// <param name="id">ID of the region</param> | ||
63 | /// <param name="x">X co-ordinate of the region</param> | ||
64 | /// <param name="y">Y co-ordinate of the region</param> | ||
65 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | ||
66 | /// <returns></returns> | ||
67 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, CommunicationsManager cm) | ||
68 | { | ||
69 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | ||
70 | regInfo.RegionName = name; | ||
71 | regInfo.RegionID = id; | ||
72 | |||
73 | AgentCircuitManager acm = new AgentCircuitManager(); | ||
74 | SceneCommunicationService scs = new SceneCommunicationService(cm); | ||
75 | |||
76 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); | ||
77 | AssetCache ac = new AssetCache(assetService); | ||
78 | |||
79 | StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); | ||
80 | IConfigSource configSource = new IniConfigSource(); | ||
81 | |||
82 | TestScene testScene = new TestScene( | ||
83 | regInfo, acm, cm, scs, ac, sm, null, false, false, false, configSource, null); | ||
84 | |||
85 | IRegionModule capsModule = new CapabilitiesModule(); | ||
86 | capsModule.Initialise(testScene, new IniConfigSource()); | ||
87 | testScene.AddModule(capsModule.Name, capsModule); | ||
88 | testScene.SetModuleInterfaces(); | ||
89 | |||
90 | testScene.LandChannel = new TestLandChannel(); | ||
91 | testScene.LoadWorldMap(); | ||
92 | |||
93 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | ||
94 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | ||
95 | testScene.PhysicsScene | ||
96 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
97 | |||
98 | return testScene; | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// Generate some standard agent connection data. | ||
103 | /// </summary> | ||
104 | /// <param name="agentId"></param> | ||
105 | /// <returns></returns> | ||
106 | public static AgentCircuitData GenerateAgentData(UUID agentId) | ||
107 | { | ||
108 | string firstName = "testfirstname"; | ||
109 | |||
110 | AgentCircuitData agentData = new AgentCircuitData(); | ||
111 | agentData.AgentID = agentId; | ||
112 | agentData.firstname = firstName; | ||
113 | agentData.lastname = "testlastname"; | ||
114 | agentData.SessionID = UUID.Zero; | ||
115 | agentData.SecureSessionID = UUID.Zero; | ||
116 | agentData.circuitcode = 123; | ||
117 | agentData.BaseFolder = UUID.Zero; | ||
118 | agentData.InventoryFolder = UUID.Zero; | ||
119 | agentData.startpos = Vector3.Zero; | ||
120 | agentData.CapsPath = "http://wibble.com"; | ||
121 | |||
122 | return agentData; | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
126 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test | ||
127 | /// </summary> | ||
128 | /// <param name="scene"></param> | ||
129 | /// <param name="agentId"></param> | ||
130 | /// <returns></returns> | ||
131 | public static TestClient AddRootAgent(Scene scene, UUID agentId) | ||
132 | { | ||
133 | return AddRootAgent(scene, GenerateAgentData(agentId)); | ||
134 | } | ||
135 | |||
136 | /// <summary> | ||
137 | /// Add a root agent. | ||
138 | /// </summary> | ||
139 | /// | ||
140 | /// This function | ||
141 | /// | ||
142 | /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the | ||
143 | /// userserver if grid) would give initial login data back to the client and separately tell the scene that the | ||
144 | /// agent was coming. | ||
145 | /// | ||
146 | /// 2) Connects the agent with the scene | ||
147 | /// | ||
148 | /// This function performs actions equivalent with notifying the scene that an agent is | ||
149 | /// coming and then actually connecting the agent to the scene. The one step missed out is the very first | ||
150 | /// | ||
151 | /// <param name="scene"></param> | ||
152 | /// <param name="agentData"></param> | ||
153 | /// <returns></returns> | ||
154 | public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) | ||
155 | { | ||
156 | // We emulate the proper login sequence here by doing things in three stages | ||
157 | // Stage 1: simulate login by telling the scene to expect a new user connection | ||
158 | scene.NewUserConnection(agentData); | ||
159 | |||
160 | // Stage 2: add the new client as a child agent to the scene | ||
161 | TestClient client = new TestClient(agentData, scene); | ||
162 | scene.AddNewClient(client); | ||
163 | |||
164 | // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, | ||
165 | // inventory, etc.) | ||
166 | scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); | ||
167 | |||
168 | return client; | ||
169 | } | ||
170 | |||
171 | /// <summary> | ||
172 | /// Add a test object | ||
173 | /// </summary> | ||
174 | /// <param name="scene"></param> | ||
175 | /// <returns></returns> | ||
176 | public static SceneObjectPart AddSceneObject(Scene scene) | ||
177 | { | ||
178 | return AddSceneObject(scene, null); | ||
179 | } | ||
180 | |||
181 | /// <summary> | ||
182 | /// Add a test object | ||
183 | /// </summary> | ||
184 | /// <param name="scene"></param> | ||
185 | /// <param name="name"></param> | ||
186 | /// <returns></returns> | ||
187 | public static SceneObjectPart AddSceneObject(Scene scene, string name) | ||
188 | { | ||
189 | SceneObjectGroup sceneObject = new SceneObjectGroup(); | ||
190 | SceneObjectPart part | ||
191 | = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | ||
192 | |||
193 | if (name != null) | ||
194 | part.Name = name; | ||
195 | |||
196 | //part.UpdatePrimFlags(false, false, true); | ||
197 | part.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
198 | sceneObject.SetRootPart(part); | ||
199 | |||
200 | scene.AddNewSceneObject(sceneObject, false); | ||
201 | |||
202 | return part; | ||
203 | } | ||
204 | |||
205 | /// <summary> | ||
206 | /// Delete a scene object asynchronously | ||
207 | /// </summary> | ||
208 | /// <param name="scene"></param> | ||
209 | /// <param name="part"></param> | ||
210 | /// <param name="action"></param> | ||
211 | /// <param name="destinationId"></param> | ||
212 | /// <param name="client"></param> | ||
213 | public static void DeleteSceneObjectAsync( | ||
214 | TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client) | ||
215 | { | ||
216 | // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test | ||
217 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
218 | sogd.Enabled = false; | ||
219 | |||
220 | scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); | ||
221 | sogd.InventoryDeQueueAndDelete(); | ||
222 | } | ||
223 | } | ||
224 | } | ||
diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs index 3bc8467..f1ad508 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Region.Environment; | |||
35 | using OpenSim.Region.Environment.Interfaces; | 35 | using OpenSim.Region.Environment.Interfaces; |
36 | using OpenSim.Region.Environment.Modules.Communications.REST; | 36 | using OpenSim.Region.Environment.Modules.Communications.REST; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | using OpenSim.Tests.Common.Setup; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.Environment.Scenes.Tests | 40 | namespace OpenSim.Region.Environment.Scenes.Tests |
40 | { | 41 | { |
@@ -61,21 +62,21 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
61 | IRegionModule interregionComms = new RESTInterregionComms(); | 62 | IRegionModule interregionComms = new RESTInterregionComms(); |
62 | 63 | ||
63 | // TODO: Clean this up | 64 | // TODO: Clean this up |
64 | Scene sceneA = SceneTestUtils.SetupScene("sceneA", sceneAId, 1000, 1000, cm); | 65 | Scene sceneA = SceneSetupHelpers.SetupScene("sceneA", sceneAId, 1000, 1000, cm); |
65 | interregionComms.Initialise(sceneA, new IniConfigSource()); | 66 | interregionComms.Initialise(sceneA, new IniConfigSource()); |
66 | sceneA.AddModule(interregionComms.Name, interregionComms); | 67 | sceneA.AddModule(interregionComms.Name, interregionComms); |
67 | sceneA.SetModuleInterfaces(); | 68 | sceneA.SetModuleInterfaces(); |
68 | sceneA.RegisterRegionWithGrid(); | 69 | sceneA.RegisterRegionWithGrid(); |
69 | 70 | ||
70 | // TODO: Clean this up | 71 | // TODO: Clean this up |
71 | Scene sceneB = SceneTestUtils.SetupScene("sceneB", sceneBId, 1010, 1010, cm); | 72 | Scene sceneB = SceneSetupHelpers.SetupScene("sceneB", sceneBId, 1010, 1010, cm); |
72 | interregionComms.Initialise(sceneB, new IniConfigSource()); | 73 | interregionComms.Initialise(sceneB, new IniConfigSource()); |
73 | sceneB.AddModule(interregionComms.Name, interregionComms); | 74 | sceneB.AddModule(interregionComms.Name, interregionComms); |
74 | sceneB.SetModuleInterfaces(); | 75 | sceneB.SetModuleInterfaces(); |
75 | sceneB.RegisterRegionWithGrid(); | 76 | sceneB.RegisterRegionWithGrid(); |
76 | 77 | ||
77 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 78 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); |
78 | TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId); | 79 | TestClient client = SceneSetupHelpers.AddRootAgent(sceneA, agentId); |
79 | 80 | ||
80 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 81 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); |
81 | 82 | ||