aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Dague2009-02-26 21:29:16 +0000
committerSean Dague2009-02-26 21:29:16 +0000
commit57ab79e3312d9856a3534a1e2343b45c6cf74ac6 (patch)
tree470f8e5afc93a0604aa1b6cdf5dde9530de1898e
parent* Apply http://opensimulator.org/mantis/view.php?id=3191 (diff)
downloadopensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.zip
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.gz
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.bz2
opensim-SC_OLD-57ab79e3312d9856a3534a1e2343b45c6cf74ac6.tar.xz
* Update ScenePresenceTests to reflect current REST communication workflow.
* Fixed an issue with AssetCache where it would break unit tests randomly. From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs38
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs58
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs113
4 files changed, 119 insertions, 92 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 2690e4e..800c997 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -210,7 +210,7 @@ namespace OpenSim.Framework.Communications.Cache
210 } 210 }
211 catch (Exception e) 211 catch (Exception e)
212 { 212 {
213 m_log.Error("[ASSET CACHE]: " + e); 213 m_log.Error("[ASSET CACHE]: " + e.ToString());
214 } 214 }
215 } 215 }
216 } 216 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 684e9c0..9fcd478 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -29,6 +29,7 @@ using Nini.Config;
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using System.Threading;
32using NUnit.Framework; 33using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers; 34using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 35using OpenMetaverse;
@@ -91,7 +92,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
91 92
92 /// <summary> 93 /// <summary>
93 /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene. 94 /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
94 /// </summary> 95 /// </summary>
95 [Test] 96 [Test]
96 public void T010_TestAddRootAgent() 97 public void T010_TestAddRootAgent()
97 { 98 {
@@ -136,9 +137,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
136 [Test] 137 [Test]
137 public void T012_TestAddNeighbourRegion() 138 public void T012_TestAddNeighbourRegion()
138 { 139 {
139 SceneSetupHelpers.AddRootAgent(scene,agent1); 140 scene.NewUserConnection(acd1);
141 scene.AddNewClient(testclient);
140 142
141 ScenePresence presence = scene.GetScenePresence(agent1); 143 ScenePresence presence = scene.GetScenePresence(agent1);
144 presence.MakeRootAgent(new Vector3(90,90,90),false);
142 145
143 string cap = presence.ControllingClient.RequestClientInfo().CapsPath; 146 string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
144 147
@@ -195,30 +198,43 @@ namespace OpenSim.Region.Framework.Scenes.Tests
195 string cap = presence.ControllingClient.RequestClientInfo().CapsPath; 198 string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
196 presence2.AddNeighbourRegion(region1, cap); 199 presence2.AddNeighbourRegion(region1, cap);
197 200
201 scene.RegisterRegionWithGrid();
202 scene2.RegisterRegionWithGrid();
203
198 Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); 204 Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
199 Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); 205 Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
200 206
201 // Cross to x+1 207 // Cross to x+1
202 presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100); 208 presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
203 scene.RegisterRegionWithGrid();
204 scene2.RegisterRegionWithGrid();
205 presence.Update(); 209 presence.Update();
206 /* With RESTComms this test needs more thinking, because of the callback 210
207 // Crossings are asynchronous 211 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
208 while (presence.IsInTransit) { }; 212
213 // Mimicking communication between client and server, by waiting OK from client
214 // sent by TestClient.CrossRegion call. Originally, this is network comm.
215 wh.WaitOne();
216
217 // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
218 // would normally be fired after receiving the reply packet from comm. done on the last line.
219 testclient.CompleteMovement();
220
221 // Crossings are asynchronous
222 while (presence.IsInTransit) { };
209 223
210 Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected."); 224 Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
211 Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent."); 225 Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
212 226
213 // Cross Back 227 // Cross Back
214 presence2.AbsolutePosition = new Vector3(-1, 3, 100); 228 presence2.AbsolutePosition = new Vector3(-10, 3, 100);
215 presence2.Update(); 229 presence2.Update();
216 // Crossings are asynchronous 230
217 while (presence2.IsInTransit) { }; 231 wh.WaitOne();
232 testclient.CompleteMovement();
233
234 while (presence2.IsInTransit) { };
218 235
219 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); 236 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
220 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); 237 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
221 */
222 } 238 }
223 239
224 [Test] 240 [Test]
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 16c55ae..0635aab 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32using log4net; 33using log4net;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenMetaverse.Packets; 35using OpenMetaverse.Packets;
@@ -41,16 +42,17 @@ namespace OpenSim.Tests.Common.Mock
41 public class TestClient : IClientAPI 42 public class TestClient : IClientAPI
42 { 43 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 45
45 // Mock testing variables 46 // Mock testing variables
46 public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>(); 47 public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
47 public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>(); 48 public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
48 49 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
50
49 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup 51 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
50 // methods on when a teleport is requested 52 // methods on when a teleport is requested
51 public Scene TeleportTargetScene; 53 public Scene TeleportTargetScene;
52 private TestClient TeleportSceneClient; 54 private TestClient TeleportSceneClient;
53 55
54 private IScene m_scene; 56 private IScene m_scene;
55 57
56// disable warning: public events, part of the public API 58// disable warning: public events, part of the public API
@@ -272,7 +274,7 @@ namespace OpenSim.Tests.Common.Mock
272 /// This agent's UUID 274 /// This agent's UUID
273 /// </value> 275 /// </value>
274 private UUID m_agentId; 276 private UUID m_agentId;
275 277
276 /// <value> 278 /// <value>
277 /// The last caps seed url that this client was given. 279 /// The last caps seed url that this client was given.
278 /// </value> 280 /// </value>
@@ -363,15 +365,15 @@ namespace OpenSim.Tests.Common.Mock
363 { 365 {
364 set { } 366 set { }
365 } 367 }
366 368
367 private uint m_circuitCode; 369 private uint m_circuitCode;
368 370
369 public uint CircuitCode 371 public uint CircuitCode
370 { 372 {
371 get { return m_circuitCode; } 373 get { return m_circuitCode; }
372 set { m_circuitCode = value; } 374 set { m_circuitCode = value; }
373 } 375 }
374 376
375 /// <summary> 377 /// <summary>
376 /// Constructor 378 /// Constructor
377 /// </summary> 379 /// </summary>
@@ -386,7 +388,7 @@ namespace OpenSim.Tests.Common.Mock
386 m_scene = scene; 388 m_scene = scene;
387 CapsSeedUrl = agentData.CapsPath; 389 CapsSeedUrl = agentData.CapsPath;
388 } 390 }
389 391
390 /// <summary> 392 /// <summary>
391 /// Attempt a teleport to the given region. 393 /// Attempt a teleport to the given region.
392 /// </summary> 394 /// </summary>
@@ -395,9 +397,9 @@ namespace OpenSim.Tests.Common.Mock
395 /// <param name="lookAt"></param> 397 /// <param name="lookAt"></param>
396 public void Teleport(ulong regionHandle, Vector3 position, Vector3 lookAt) 398 public void Teleport(ulong regionHandle, Vector3 position, Vector3 lookAt)
397 { 399 {
398 OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16); 400 OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16);
399 } 401 }
400 402
401 public void CompleteMovement() 403 public void CompleteMovement()
402 { 404 {
403 OnCompleteMovementToRegion(); 405 OnCompleteMovementToRegion();
@@ -501,46 +503,52 @@ namespace OpenSim.Tests.Common.Mock
501 agentData.child = false; 503 agentData.child = false;
502 agentData.firstname = m_firstName; 504 agentData.firstname = m_firstName;
503 agentData.lastname = m_lastName; 505 agentData.lastname = m_lastName;
504 506
505 ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); 507 ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
506 agentData.CapsPath = capsModule.GetCapsPath(m_agentId); 508 agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
507 agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId)); 509 agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
508 510
509 return agentData; 511 return agentData;
510 } 512 }
511 513
512 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) 514 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
513 { 515 {
514 m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour"); 516 m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour");
515 517
516 // In response to this message, we are going to make a teleport to the scene we've previous been told 518 // In response to this message, we are going to make a teleport to the scene we've previous been told
517 // about by test code (this needs to be improved). 519 // about by test code (this needs to be improved).
518 AgentCircuitData newAgent = RequestClientInfo(); 520 AgentCircuitData newAgent = RequestClientInfo();
519 521
520 // Stage 2: add the new client as a child agent to the scene 522 // Stage 2: add the new client as a child agent to the scene
521 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); 523 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
522 TeleportTargetScene.AddNewClient(TeleportSceneClient); 524 TeleportTargetScene.AddNewClient(TeleportSceneClient);
523 } 525 }
524 526
525 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 527 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
526 uint locationID, uint flags, string capsURL) 528 uint locationID, uint flags, string capsURL)
527 { 529 {
528 m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport"); 530 m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
529 531
530 CapsSeedUrl = capsURL; 532 CapsSeedUrl = capsURL;
531 533
532 TeleportSceneClient.CompleteMovement(); 534 TeleportSceneClient.CompleteMovement();
533 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); 535 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
534 } 536 }
535 537
536 public virtual void SendTeleportFailed(string reason) 538 public virtual void SendTeleportFailed(string reason)
537 { 539 {
538 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); 540 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);
539 } 541 }
540 542
541 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, 543 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
542 IPEndPoint newRegionExternalEndPoint, string capsURL) 544 IPEndPoint newRegionExternalEndPoint, string capsURL)
543 { 545 {
546 // This is supposed to send a packet to the client telling it's ready to start region crossing.
547 // Instead I will just signal I'm ready, mimicking the communication behavior.
548 // It's ugly, but avoids needless communication setup. This is used in ScenePresenceTests.cs.
549 // Arthur V.
550
551 wh.Set();
544 } 552 }
545 553
546 public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag) 554 public virtual void SendMapBlock(List<MapBlockData> mapBlocks, uint flag)
@@ -845,7 +853,7 @@ namespace OpenSim.Tests.Common.Mock
845 public void Start() 853 public void Start()
846 { 854 {
847 } 855 }
848 856
849 public void Stop() 857 public void Stop()
850 { 858 {
851 } 859 }
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index b52c081..bcc9426 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -40,12 +40,12 @@ using OpenSim.Region.CoreModules.Agent.Capabilities;
40using OpenSim.Tests.Common.Mock; 40using OpenSim.Tests.Common.Mock;
41 41
42namespace OpenSim.Tests.Common.Setup 42namespace OpenSim.Tests.Common.Setup
43{ 43{
44 /// <summary> 44 /// <summary>
45 /// Helpers for setting up scenes. 45 /// Helpers for setting up scenes.
46 /// </summary> 46 /// </summary>
47 public class SceneSetupHelpers 47 public class SceneSetupHelpers
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Set up a test scene 50 /// Set up a test scene
51 /// </summary> 51 /// </summary>
@@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common.Setup
54 { 54 {
55 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); 55 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager());
56 } 56 }
57 57
58 /// <summary> 58 /// <summary>
59 /// Set up a test scene 59 /// Set up a test scene
60 /// </summary> 60 /// </summary>
@@ -69,32 +69,32 @@ namespace OpenSim.Tests.Common.Setup
69 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 69 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
70 regInfo.RegionName = name; 70 regInfo.RegionName = name;
71 regInfo.RegionID = id; 71 regInfo.RegionID = id;
72 72
73 AgentCircuitManager acm = new AgentCircuitManager(); 73 AgentCircuitManager acm = new AgentCircuitManager();
74 SceneCommunicationService scs = new SceneCommunicationService(cm); 74 SceneCommunicationService scs = new SceneCommunicationService(cm);
75 75
76 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); 76 StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", "");
77 IConfigSource configSource = new IniConfigSource(); 77 IConfigSource configSource = new IniConfigSource();
78 78
79 TestScene testScene = new TestScene( 79 TestScene testScene = new TestScene(
80 regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); 80 regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null);
81 81
82 IRegionModule capsModule = new CapabilitiesModule(); 82 IRegionModule capsModule = new CapabilitiesModule();
83 capsModule.Initialise(testScene, new IniConfigSource()); 83 capsModule.Initialise(testScene, new IniConfigSource());
84 testScene.AddModule(capsModule.Name, capsModule); 84 testScene.AddModule(capsModule.Name, capsModule);
85 testScene.SetModuleInterfaces(); 85 testScene.SetModuleInterfaces();
86 86
87 testScene.LandChannel = new TestLandChannel(); 87 testScene.LandChannel = new TestLandChannel();
88 testScene.LoadWorldMap(); 88 testScene.LoadWorldMap();
89 89
90 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 90 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
91 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 91 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
92 testScene.PhysicsScene 92 testScene.PhysicsScene
93 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); 93 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test");
94 94
95 return testScene; 95 return testScene;
96 } 96 }
97 97
98 /// <summary> 98 /// <summary>
99 /// Setup modules for a scene using their default settings. 99 /// Setup modules for a scene using their default settings.
100 /// </summary> 100 /// </summary>
@@ -102,9 +102,9 @@ namespace OpenSim.Tests.Common.Setup
102 /// <param name="modules"></param> 102 /// <param name="modules"></param>
103 public static void SetupSceneModules(Scene scene, params IRegionModule[] modules) 103 public static void SetupSceneModules(Scene scene, params IRegionModule[] modules)
104 { 104 {
105 SetupSceneModules(scene, null, modules); 105 SetupSceneModules(scene, null, modules);
106 } 106 }
107 107
108 /// <summary> 108 /// <summary>
109 /// Setup modules for a scene. 109 /// Setup modules for a scene.
110 /// </summary> 110 /// </summary>
@@ -115,13 +115,13 @@ namespace OpenSim.Tests.Common.Setup
115 { 115 {
116 foreach (IRegionModule module in modules) 116 foreach (IRegionModule module in modules)
117 { 117 {
118 module.Initialise(scene, config); 118 module.Initialise(scene, config);
119 scene.AddModule(module.Name, module); 119 scene.AddModule(module.Name, module);
120 } 120 }
121 121
122 scene.SetModuleInterfaces(); 122 scene.SetModuleInterfaces();
123 } 123 }
124 124
125 /// <summary> 125 /// <summary>
126 /// Generate some standard agent connection data. 126 /// Generate some standard agent connection data.
127 /// </summary> 127 /// </summary>
@@ -130,7 +130,7 @@ namespace OpenSim.Tests.Common.Setup
130 public static AgentCircuitData GenerateAgentData(UUID agentId) 130 public static AgentCircuitData GenerateAgentData(UUID agentId)
131 { 131 {
132 string firstName = "testfirstname"; 132 string firstName = "testfirstname";
133 133
134 AgentCircuitData agentData = new AgentCircuitData(); 134 AgentCircuitData agentData = new AgentCircuitData();
135 agentData.AgentID = agentId; 135 agentData.AgentID = agentId;
136 agentData.firstname = firstName; 136 agentData.firstname = firstName;
@@ -142,10 +142,10 @@ namespace OpenSim.Tests.Common.Setup
142 agentData.InventoryFolder = UUID.Zero; 142 agentData.InventoryFolder = UUID.Zero;
143 agentData.startpos = Vector3.Zero; 143 agentData.startpos = Vector3.Zero;
144 agentData.CapsPath = "http://wibble.com"; 144 agentData.CapsPath = "http://wibble.com";
145 145
146 return agentData; 146 return agentData;
147 } 147 }
148 148
149 /// <summary> 149 /// <summary>
150 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test 150 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
151 /// </summary> 151 /// </summary>
@@ -153,55 +153,58 @@ namespace OpenSim.Tests.Common.Setup
153 /// <param name="agentId"></param> 153 /// <param name="agentId"></param>
154 /// <returns></returns> 154 /// <returns></returns>
155 public static TestClient AddRootAgent(Scene scene, UUID agentId) 155 public static TestClient AddRootAgent(Scene scene, UUID agentId)
156 { 156 {
157 return AddRootAgent(scene, GenerateAgentData(agentId)); 157 return AddRootAgent(scene, GenerateAgentData(agentId));
158 } 158 }
159 159
160 /// <summary> 160 /// <summary>
161 /// Add a root agent. 161 /// Add a root agent.
162 /// </summary> 162 /// </summary>
163 /// 163 ///
164 /// This function 164 /// This function
165 /// 165 ///
166 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the 166 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
167 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the 167 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the
168 /// agent was coming. 168 /// agent was coming.
169 /// 169 ///
170 /// 2) Connects the agent with the scene 170 /// 2) Connects the agent with the scene
171 /// 171 ///
172 /// This function performs actions equivalent with notifying the scene that an agent is 172 /// This function performs actions equivalent with notifying the scene that an agent is
173 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first 173 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
174 /// 174 ///
175 /// <param name="scene"></param> 175 /// <param name="scene"></param>
176 /// <param name="agentData"></param> 176 /// <param name="agentData"></param>
177 /// <returns></returns> 177 /// <returns></returns>
178 public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) 178 public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData)
179 { 179 {
180 // We emulate the proper login sequence here by doing things in three stages 180 // We emulate the proper login sequence here by doing things in three stages
181 // Stage 1: simulate login by telling the scene to expect a new user connection 181 // Stage 1: simulate login by telling the scene to expect a new user connection
182 scene.NewUserConnection(agentData); 182 scene.NewUserConnection(agentData);
183 183
184 // Stage 2: add the new client as a child agent to the scene 184 // Stage 2: add the new client as a child agent to the scene
185 TestClient client = new TestClient(agentData, scene); 185 TestClient client = new TestClient(agentData, scene);
186 scene.AddNewClient(client); 186 scene.AddNewClient(client);
187 187
188 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, 188 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
189 // inventory, etc.) 189 // inventory, etc.)
190 scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); 190 //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
191 191
192 return client; 192 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
193 scp.MakeRootAgent(new Vector3(90,90,90), true);
194
195 return client;
193 } 196 }
194 197
195 /// <summary> 198 /// <summary>
196 /// Add a test object 199 /// Add a test object
197 /// </summary> 200 /// </summary>
198 /// <param name="scene"></param> 201 /// <param name="scene"></param>
199 /// <returns></returns> 202 /// <returns></returns>
200 public static SceneObjectPart AddSceneObject(Scene scene) 203 public static SceneObjectPart AddSceneObject(Scene scene)
201 { 204 {
202 return AddSceneObject(scene, "Test Object"); 205 return AddSceneObject(scene, "Test Object");
203 } 206 }
204 207
205 /// <summary> 208 /// <summary>
206 /// Add a test object 209 /// Add a test object
207 /// </summary> 210 /// </summary>
@@ -209,19 +212,19 @@ namespace OpenSim.Tests.Common.Setup
209 /// <param name="name"></param> 212 /// <param name="name"></param>
210 /// <returns></returns> 213 /// <returns></returns>
211 public static SceneObjectPart AddSceneObject(Scene scene, string name) 214 public static SceneObjectPart AddSceneObject(Scene scene, string name)
212 { 215 {
213 SceneObjectPart part 216 SceneObjectPart part
214 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 217 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
215 part.Name = name; 218 part.Name = name;
216 219
217 //part.UpdatePrimFlags(false, false, true); 220 //part.UpdatePrimFlags(false, false, true);
218 //part.ObjectFlags |= (uint)PrimFlags.Phantom; 221 //part.ObjectFlags |= (uint)PrimFlags.Phantom;
219 222
220 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 223 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
221 224
222 return part; 225 return part;
223 } 226 }
224 227
225 /// <summary> 228 /// <summary>
226 /// Delete a scene object asynchronously 229 /// Delete a scene object asynchronously
227 /// </summary> 230 /// </summary>
@@ -238,7 +241,7 @@ namespace OpenSim.Tests.Common.Setup
238 sogd.Enabled = false; 241 sogd.Enabled = false;
239 242
240 scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); 243 scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId);
241 sogd.InventoryDeQueueAndDelete(); 244 sogd.InventoryDeQueueAndDelete();
242 } 245 }
243 } 246 }
244} 247}