aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorSean Dague2009-02-26 21:29:16 +0000
committerSean Dague2009-02-26 21:29:16 +0000
commit57ab79e3312d9856a3534a1e2343b45c6cf74ac6 (patch)
tree470f8e5afc93a0604aa1b6cdf5dde9530de1898e /OpenSim/Region/Framework
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>
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs38
1 files changed, 27 insertions, 11 deletions
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]