diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | 137 |
1 files changed, 45 insertions, 92 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index ef52363..efb757f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -34,12 +34,12 @@ using System.Timers; | |||
34 | using Timer=System.Timers.Timer; | 34 | using Timer=System.Timers.Timer; |
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using NUnit.Framework; | 36 | using NUnit.Framework; |
37 | using NUnit.Framework.SyntaxHelpers; | ||
38 | using OpenMetaverse; | 37 | using OpenMetaverse; |
39 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
41 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Region.Framework.Interfaces; | 41 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
43 | using OpenSim.Region.CoreModules.World.Serialiser; | 43 | using OpenSim.Region.CoreModules.World.Serialiser; |
44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 44 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
@@ -116,9 +116,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | 116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); |
117 | agent.child = true; | 117 | agent.child = true; |
118 | 118 | ||
119 | if (scene.PresenceService == null) | ||
120 | Console.WriteLine("Presence Service is null"); | ||
121 | |||
122 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); | 119 | scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); |
123 | 120 | ||
124 | string reason; | 121 | string reason; |
@@ -175,25 +172,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
175 | 172 | ||
176 | Assert.That(neighbours.Count, Is.EqualTo(2)); | 173 | Assert.That(neighbours.Count, Is.EqualTo(2)); |
177 | } | 174 | } |
178 | |||
179 | public void fixNullPresence() | ||
180 | { | ||
181 | string firstName = "testfirstname"; | ||
182 | |||
183 | AgentCircuitData agent = new AgentCircuitData(); | ||
184 | agent.AgentID = agent1; | ||
185 | agent.firstname = firstName; | ||
186 | agent.lastname = "testlastname"; | ||
187 | agent.SessionID = UUID.Zero; | ||
188 | agent.SecureSessionID = UUID.Zero; | ||
189 | agent.circuitcode = 123; | ||
190 | agent.BaseFolder = UUID.Zero; | ||
191 | agent.InventoryFolder = UUID.Zero; | ||
192 | agent.startpos = Vector3.Zero; | ||
193 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
194 | |||
195 | acd1 = agent; | ||
196 | } | ||
197 | 175 | ||
198 | [Test] | 176 | [Test] |
199 | public void T013_TestRemoveNeighbourRegion() | 177 | public void T013_TestRemoveNeighbourRegion() |
@@ -211,24 +189,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
211 | CompleteAvatarMovement | 189 | CompleteAvatarMovement |
212 | */ | 190 | */ |
213 | } | 191 | } |
214 | 192 | ||
215 | // I'm commenting this test, because this is not supposed to happen here | 193 | /// <summary> |
216 | //[Test] | 194 | /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region |
217 | public void T020_TestMakeRootAgent() | 195 | /// </summary> |
196 | /// <remarks> | ||
197 | /// Please note that unlike the other tests here, this doesn't rely on structures | ||
198 | /// </remarks> | ||
199 | [Test] | ||
200 | public void TestChildAgentEstablished() | ||
218 | { | 201 | { |
219 | TestHelper.InMethod(); | 202 | TestHelper.InMethod(); |
220 | 203 | // log4net.Config.XmlConfigurator.Configure(); | |
221 | ScenePresence presence = scene.GetScenePresence(agent1); | 204 | |
222 | Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent"); | 205 | UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
223 | 206 | ||
224 | presence.MakeChildAgent(); | 207 | TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); |
225 | Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); | 208 | TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); |
226 | 209 | ||
227 | // Accepts 0 but rejects Constants.RegionSize | 210 | IConfigSource configSource = new IniConfigSource(); |
228 | Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); | 211 | configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule"); |
229 | presence.MakeRootAgent(pos,true); | 212 | EntityTransferModule etm = new EntityTransferModule(); |
230 | Assert.That(presence.IsChildAgent, Is.False, "Did not go back to root agent"); | 213 | |
231 | Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); | 214 | SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm); |
215 | |||
216 | SceneSetupHelpers.AddRootAgent(myScene1, agent1Id); | ||
217 | ScenePresence childPresence = myScene2.GetScenePresence(agent1); | ||
218 | |||
219 | // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents | ||
220 | // Assert.That(childPresence, Is.Not.Null); | ||
221 | // Assert.That(childPresence.IsChildAgent, Is.True); | ||
232 | } | 222 | } |
233 | 223 | ||
234 | // I'm commenting this test because it does not represent | 224 | // I'm commenting this test because it does not represent |
@@ -333,63 +323,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); | 323 | Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); |
334 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); | 324 | Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); |
335 | } | 325 | } |
336 | 326 | ||
337 | [Test] | 327 | public void fixNullPresence() |
338 | public void T030_TestAddAttachments() | ||
339 | { | ||
340 | TestHelper.InMethod(); | ||
341 | |||
342 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
343 | |||
344 | presence.AddAttachment(sog1); | ||
345 | presence.AddAttachment(sog2); | ||
346 | presence.AddAttachment(sog3); | ||
347 | |||
348 | Assert.That(presence.HasAttachments(), Is.True); | ||
349 | Assert.That(presence.ValidateAttachments(), Is.True); | ||
350 | } | ||
351 | |||
352 | [Test] | ||
353 | public void T031_RemoveAttachments() | ||
354 | { | ||
355 | TestHelper.InMethod(); | ||
356 | |||
357 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
358 | presence.RemoveAttachment(sog1); | ||
359 | presence.RemoveAttachment(sog2); | ||
360 | presence.RemoveAttachment(sog3); | ||
361 | Assert.That(presence.HasAttachments(), Is.False); | ||
362 | } | ||
363 | |||
364 | // I'm commenting this test because scene setup NEEDS InventoryService to | ||
365 | // be non-null | ||
366 | //[Test] | ||
367 | public void T032_CrossAttachments() | ||
368 | { | 328 | { |
369 | TestHelper.InMethod(); | 329 | string firstName = "testfirstname"; |
370 | |||
371 | ScenePresence presence = scene.GetScenePresence(agent1); | ||
372 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | ||
373 | presence2.AddAttachment(sog1); | ||
374 | presence2.AddAttachment(sog2); | ||
375 | |||
376 | ISharedRegionModule serialiser = new SerialiserModule(); | ||
377 | SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser); | ||
378 | SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser); | ||
379 | |||
380 | Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross"); | ||
381 | 330 | ||
382 | //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); | 331 | AgentCircuitData agent = new AgentCircuitData(); |
383 | Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); | 332 | agent.AgentID = agent1; |
384 | Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); | 333 | agent.firstname = firstName; |
385 | } | 334 | agent.lastname = "testlastname"; |
335 | agent.SessionID = UUID.Zero; | ||
336 | agent.SecureSessionID = UUID.Zero; | ||
337 | agent.circuitcode = 123; | ||
338 | agent.BaseFolder = UUID.Zero; | ||
339 | agent.InventoryFolder = UUID.Zero; | ||
340 | agent.startpos = Vector3.Zero; | ||
341 | agent.CapsPath = GetRandomCapsObjectPath(); | ||
386 | 342 | ||
387 | [TearDown] | 343 | acd1 = agent; |
388 | public void TearDown() | ||
389 | { | ||
390 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | ||
391 | } | 344 | } |
392 | 345 | ||
393 | public static string GetRandomCapsObjectPath() | 346 | public static string GetRandomCapsObjectPath() |
394 | { | 347 | { |
395 | UUID caps = UUID.Random(); | 348 | UUID caps = UUID.Random(); |