aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs101
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs83
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs103
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs162
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs137
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs2
21 files changed, 423 insertions, 250 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
index 4a21dc9..e209221 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs
@@ -37,7 +37,7 @@ using OpenSim.Tests.Common;
37namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
38{ 38{
39 [TestFixture] 39 [TestFixture]
40 public class BorderTests 40 public class BorderTests : OpenSimTestCase
41 { 41 {
42 [Test] 42 [Test]
43 public void TestCross() 43 public void TestCross()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index ea9fc93..766ce83 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common;
41namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
42{ 42{
43 [TestFixture, LongRunning] 43 [TestFixture, LongRunning]
44 public class EntityManagerTests 44 public class EntityManagerTests : OpenSimTestCase
45 { 45 {
46 static public Random random; 46 static public Random random;
47 SceneObjectGroup found; 47 SceneObjectGroup found;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index d23c965..575a081 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneGraphTests 43 public class SceneGraphTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestDuplicateObject() 46 public void TestDuplicateObject()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
index ab56f4e..2d831fa 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock;
41namespace OpenSim.Region.Framework.Scenes.Tests 41namespace OpenSim.Region.Framework.Scenes.Tests
42{ 42{
43 [TestFixture] 43 [TestFixture]
44 public class SceneManagerTests 44 public class SceneManagerTests : OpenSimTestCase
45 { 45 {
46 [Test] 46 [Test]
47 public void TestClose() 47 public void TestClose()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 5b334c6..a07d64c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using Nini.Config;
32using NUnit.Framework; 33using NUnit.Framework;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -182,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
182 /// <summary> 183 /// <summary>
183 /// Test deleting an object from a scene. 184 /// Test deleting an object from a scene.
184 /// </summary> 185 /// </summary>
186 /// <remarks>
187 /// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously
188 /// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests.
189 /// </remarks>
185 [Test] 190 [Test]
186 public void TestDeleteSceneObject() 191 public void TestDeleteSceneObject()
187 { 192 {
@@ -201,100 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
201 } 206 }
202 207
203 /// <summary> 208 /// <summary>
204 /// Test deleting an object asynchronously
205 /// </summary>
206 [Test]
207 public void TestDeleteSceneObjectAsync()
208 {
209 TestHelpers.InMethod();
210 //log4net.Config.XmlConfigurator.Configure();
211
212 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
213
214 TestScene scene = new SceneHelpers().SetupScene();
215
216 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
217 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
218 sogd.Enabled = false;
219
220 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
221
222 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
223 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
224
225 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
226
227 Assert.That(retrievedPart, Is.Not.Null);
228
229 Assert.That(so.IsDeleted, Is.False);
230
231 sogd.InventoryDeQueueAndDelete();
232
233 Assert.That(so.IsDeleted, Is.True);
234
235 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
236 Assert.That(retrievedPart2, Is.Null);
237 }
238
239 /// <summary>
240 /// Test deleting an object asynchronously to user inventory.
241 /// </summary>
242// [Test]
243 public void TestDeleteSceneObjectAsyncToUserInventory()
244 {
245 TestHelpers.InMethod();
246 TestHelpers.EnableLogging();
247
248 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
249 string myObjectName = "Fred";
250
251 TestScene scene = new SceneHelpers().SetupScene();
252
253 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
254 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
255 sogd.Enabled = false;
256
257 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
258
259// Assert.That(
260// scene.CommsManager.UserAdminService.AddUser(
261// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
262// Is.EqualTo(agentId));
263
264 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
265 InventoryFolderBase folder1
266 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
267
268 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
269 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
270
271 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
272
273 Assert.That(retrievedPart, Is.Not.Null);
274 Assert.That(so.IsDeleted, Is.False);
275
276 sogd.InventoryDeQueueAndDelete();
277
278 Assert.That(so.IsDeleted, Is.True);
279
280 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
281 Assert.That(retrievedPart2, Is.Null);
282
283// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
284
285 InventoryItemBase retrievedItem
286 = UserInventoryHelpers.GetInventoryItem(
287 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
288
289 // Check that we now have the taken part in our inventory
290 Assert.That(retrievedItem, Is.Not.Null);
291
292 // Check that the taken part has actually disappeared
293// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
294// Assert.That(retrievedPart, Is.Null);
295 }
296
297 /// <summary>
298 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not 209 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
299 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by 210 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
300 /// OpenSim. 211 /// OpenSim.
@@ -329,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
329 Assert.That(sog.Parts.Length, Is.EqualTo(2)); 240 Assert.That(sog.Parts.Length, Is.EqualTo(2));
330 } 241 }
331 } 242 }
332} 243} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 0076f41..52ad538 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,22 +33,24 @@ using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.InventoryAccess;
36using OpenSim.Region.CoreModules.World.Permissions; 37using OpenSim.Region.CoreModules.World.Permissions;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 40using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 41using OpenSim.Tests.Common.Mock;
40 42
41namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
42{ 44{
43 /// <summary> 45 /// <summary>
44 /// Tests derez of scene objects by users. 46 /// Tests derez of scene objects.
45 /// </summary> 47 /// </summary>
46 /// <remarks> 48 /// <remarks>
47 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. 49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
48 /// TODO: These tests are very incomplete - they only test for a few conditions. 50 /// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object).
49 /// </remarks> 51 /// </remarks>
50 [TestFixture] 52 [TestFixture]
51 public class SceneObjectDeRezTests 53 public class SceneObjectDeRezTests : OpenSimTestCase
52 { 54 {
53 /// <summary> 55 /// <summary>
54 /// Test deleting an object from a scene. 56 /// Test deleting an object from a scene.
@@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 78 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
77 part.Name = "obj1"; 79 part.Name = "obj1";
78 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 80 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
81
79 List<uint> localIds = new List<uint>(); 82 List<uint> localIds = new List<uint>();
80 localIds.Add(part.LocalId); 83 localIds.Add(part.LocalId);
81
82 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 84 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
85
86 // Check that object isn't deleted until we crank the sogd handle.
87 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
88 Assert.That(retrievedPart, Is.Not.Null);
89 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
90
83 sogd.InventoryDeQueueAndDelete(); 91 sogd.InventoryDeQueueAndDelete();
84 92
85 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 93 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
86 Assert.That(retrievedPart, Is.Null); 94 Assert.That(retrievedPart2, Is.Null);
87 } 95 }
88 96
89 /// <summary> 97 /// <summary>
@@ -124,6 +132,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
124 // Object should still be in the scene. 132 // Object should still be in the scene.
125 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 133 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
126 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 134 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
127 } 135 }
136
137 /// <summary>
138 /// Test deleting an object asynchronously to user inventory.
139 /// </summary>
140 [Test]
141 public void TestDeleteSceneObjectAsyncToUserInventory()
142 {
143 TestHelpers.InMethod();
144// TestHelpers.EnableLogging();
145
146 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
147 string myObjectName = "Fred";
148
149 TestScene scene = new SceneHelpers().SetupScene();
150
151 IConfigSource configSource = new IniConfigSource();
152 IConfig config = configSource.AddConfig("Modules");
153 config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
154 SceneHelpers.SetupSceneModules(
155 scene, configSource, new object[] { new BasicInventoryAccessModule() });
156
157 SceneHelpers.SetupSceneModules(scene, new object[] { });
158
159 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
160 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
161 sogd.Enabled = false;
162
163 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
164
165 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
166 InventoryFolderBase folder1
167 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1", false);
168
169 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
170 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
171
172 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
173
174 Assert.That(retrievedPart, Is.Not.Null);
175 Assert.That(so.IsDeleted, Is.False);
176
177 sogd.InventoryDeQueueAndDelete();
178
179 Assert.That(so.IsDeleted, Is.True);
180
181 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
182 Assert.That(retrievedPart2, Is.Null);
183
184// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
185
186 InventoryItemBase retrievedItem
187 = UserInventoryHelpers.GetInventoryItem(
188 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
189
190 // Check that we now have the taken part in our inventory
191 Assert.That(retrievedItem, Is.Not.Null);
192
193 // Check that the taken part has actually disappeared
194// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
195// Assert.That(retrievedPart, Is.Null);
196 }
128 } 197 }
129} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0e525c9..9378e20 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -40,7 +40,7 @@ using log4net;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests : OpenSimTestCase
44 { 44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 46
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
index e931859..1182c96 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
41 /// Basic scene object resize tests 41 /// Basic scene object resize tests
42 /// </summary> 42 /// </summary>
43 [TestFixture] 43 [TestFixture]
44 public class SceneObjectResizeTests 44 public class SceneObjectResizeTests : OpenSimTestCase
45 { 45 {
46 /// <summary> 46 /// <summary>
47 /// Test resizing an object 47 /// Test resizing an object
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
index d2361f8..a58e735 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs
@@ -40,7 +40,7 @@ using OpenSim.Tests.Common.Mock;
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 [TestFixture] 42 [TestFixture]
43 public class SceneObjectScriptTests 43 public class SceneObjectScriptTests : OpenSimTestCase
44 { 44 {
45 [Test] 45 [Test]
46 public void TestAddScript() 46 public void TestAddScript()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index 6d255aa..abaa1d1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -42,14 +42,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.) 42 /// Spatial scene object tests (will eventually cover root and child part position, rotation properties, etc.)
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectSpatialTests 45 public class SceneObjectSpatialTests : OpenSimTestCase
46 { 46 {
47 TestScene m_scene; 47 TestScene m_scene;
48 UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 49
50 [SetUp] 50 [SetUp]
51 public void SetUp() 51 public override void SetUp()
52 { 52 {
53 base.SetUp();
54
53 m_scene = new SceneHelpers().SetupScene(); 55 m_scene = new SceneHelpers().SetupScene();
54 } 56 }
55 57
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 742c769..8eb3191 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Basic scene object status tests 42 /// Basic scene object status tests
43 /// </summary> 43 /// </summary>
44 [TestFixture] 44 [TestFixture]
45 public class SceneObjectStatusTests 45 public class SceneObjectStatusTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 private UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 private UUID m_ownerId = TestHelpers.ParseTail(0x1);
@@ -78,6 +78,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests
78 } 78 }
79 79
80 [Test] 80 [Test]
81 public void TestSetNonPhysicsVolumeDetectSinglePrim()
82 {
83 TestHelpers.InMethod();
84
85 m_scene.AddSceneObject(m_so1);
86
87 SceneObjectPart rootPart = m_so1.RootPart;
88 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
89
90 m_so1.ScriptSetVolumeDetect(true);
91
92// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom));
94
95 m_so1.ScriptSetVolumeDetect(false);
96
97 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
98 }
99
100 [Test]
81 public void TestSetPhysicsSinglePrim() 101 public void TestSetPhysicsSinglePrim()
82 { 102 {
83 TestHelpers.InMethod(); 103 TestHelpers.InMethod();
@@ -89,13 +109,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests
89 109
90 m_so1.ScriptSetPhysicsStatus(true); 110 m_so1.ScriptSetPhysicsStatus(true);
91 111
92// Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags);
93 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); 112 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
94 113
95 m_so1.ScriptSetPhysicsStatus(false); 114 m_so1.ScriptSetPhysicsStatus(false);
96 115
97 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 116 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
98 } 117 }
118
119 [Test]
120 public void TestSetPhysicsVolumeDetectSinglePrim()
121 {
122 TestHelpers.InMethod();
123
124 m_scene.AddSceneObject(m_so1);
125
126 SceneObjectPart rootPart = m_so1.RootPart;
127 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
128
129 m_so1.ScriptSetPhysicsStatus(true);
130 m_so1.ScriptSetVolumeDetect(true);
131
132 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics));
133
134 m_so1.ScriptSetVolumeDetect(false);
135
136 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics));
137 }
99 138
100 [Test] 139 [Test]
101 public void TestSetPhysicsLinkset() 140 public void TestSetPhysicsLinkset()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index 5faf131..bbfbbfc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -289,108 +289,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
289// 289//
290// Assert.That(presence, Is.Null, "presence is not null"); 290// Assert.That(presence, Is.Null, "presence is not null");
291// } 291// }
292
293 // I'm commenting this test because it does not represent
294 // crossings. The Thread.Sleep's in here are not meaningful mocks,
295 // and they sometimes fail in panda.
296 // We need to talk in order to develop a test
297 // that really tests region crossings. There are 3 async components,
298 // but things are synchronous among them. So there should be
299 // 3 threads in here.
300 //[Test]
301// public void T021_TestCrossToNewRegion()
302// {
303// TestHelpers.InMethod();
304//
305// scene.RegisterRegionWithGrid();
306// scene2.RegisterRegionWithGrid();
307//
308// // Adding child agent to region 1001
309// string reason;
310// scene2.NewUserConnection(acd1,0, out reason);
311// scene2.AddNewClient(testclient, PresenceType.User);
312//
313// ScenePresence presence = scene.GetScenePresence(agent1);
314// presence.MakeRootAgent(new Vector3(0,unchecked(Constants.RegionSize-1),0), true);
315//
316// ScenePresence presence2 = scene2.GetScenePresence(agent1);
317//
318// // Adding neighbour region caps info to presence2
319//
320// string cap = presence.ControllingClient.RequestClientInfo().CapsPath;
321// presence2.AddNeighbourRegion(region1, cap);
322//
323// Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region.");
324// Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region.");
325//
326// // Cross to x+1
327// presence.AbsolutePosition = new Vector3(Constants.RegionSize+1,3,100);
328// presence.Update();
329//
330// EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
331//
332// // Mimicking communication between client and server, by waiting OK from client
333// // sent by TestClient.CrossRegion call. Originally, this is network comm.
334// if (!wh.WaitOne(5000,false))
335// {
336// presence.Update();
337// if (!wh.WaitOne(8000,false))
338// throw new ArgumentException("1 - Timeout waiting for signal/variable.");
339// }
340//
341// // This is a TestClient specific method that fires OnCompleteMovementToRegion event, which
342// // would normally be fired after receiving the reply packet from comm. done on the last line.
343// testclient.CompleteMovement();
344//
345// // Crossings are asynchronous
346// int timer = 10;
347//
348// // Make sure cross hasn't already finished
349// if (!presence.IsInTransit && !presence.IsChildAgent)
350// {
351// // If not and not in transit yet, give it some more time
352// Thread.Sleep(5000);
353// }
354//
355// // Enough time, should at least be in transit by now.
356// while (presence.IsInTransit && timer > 0)
357// {
358// Thread.Sleep(1000);
359// timer-=1;
360// }
361//
362// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 2->1.");
363// Assert.That(presence.IsChildAgent, Is.True, "Did not complete region cross as expected.");
364// Assert.That(presence2.IsChildAgent, Is.False, "Did not receive root status after receiving agent.");
365//
366// // Cross Back
367// presence2.AbsolutePosition = new Vector3(-10, 3, 100);
368// presence2.Update();
369//
370// if (!wh.WaitOne(5000,false))
371// {
372// presence2.Update();
373// if (!wh.WaitOne(8000,false))
374// throw new ArgumentException("2 - Timeout waiting for signal/variable.");
375// }
376// testclient.CompleteMovement();
377//
378// if (!presence2.IsInTransit && !presence2.IsChildAgent)
379// {
380// // If not and not in transit yet, give it some more time
381// Thread.Sleep(5000);
382// }
383//
384// // Enough time, should at least be in transit by now.
385// while (presence2.IsInTransit && timer > 0)
386// {
387// Thread.Sleep(1000);
388// timer-=1;
389// }
390//
391// Assert.That(timer,Is.GreaterThan(0),"Timed out waiting to cross 1->2.");
392// Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
393// Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
394// }
395 } 292 }
396} \ No newline at end of file 293} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
index 646e5fa..1cd8ae9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
51 /// Scene presence animation tests 51 /// Scene presence animation tests
52 /// </summary> 52 /// </summary>
53 [TestFixture] 53 [TestFixture]
54 public class ScenePresenceAnimationTests 54 public class ScenePresenceAnimationTests : OpenSimTestCase
55 { 55 {
56 [Test] 56 [Test]
57 public void TestFlyingAnimation() 57 public void TestFlyingAnimation()
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index 1d1ff88..d80afd3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -42,7 +42,7 @@ using OpenSim.Tests.Common.Mock;
42namespace OpenSim.Region.Framework.Scenes.Tests 42namespace OpenSim.Region.Framework.Scenes.Tests
43{ 43{
44 [TestFixture] 44 [TestFixture]
45 public class ScenePresenceAutopilotTests 45 public class ScenePresenceAutopilotTests : OpenSimTestCase
46 { 46 {
47 private TestScene m_scene; 47 private TestScene m_scene;
48 48
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
new file mode 100644
index 0000000..8775949
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -0,0 +1,162 @@
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 OpenSimulator 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
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using Nini.Config;
32using NUnit.Framework;
33using OpenMetaverse;
34using OpenSim.Framework;
35using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers;
37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.CoreModules.Framework;
39using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43
44namespace OpenSim.Region.Framework.Scenes.Tests
45{
46 [TestFixture]
47 public class ScenePresenceCrossingTests : OpenSimTestCase
48 {
49 [TestFixtureSetUp]
50 public void FixtureInit()
51 {
52 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
53 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
54 }
55
56 [TestFixtureTearDown]
57 public void TearDown()
58 {
59 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
60 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
61 // tests really shouldn't).
62 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
63 }
64
65 [Test]
66 public void TestCrossOnSameSimulator()
67 {
68 TestHelpers.InMethod();
69// TestHelpers.EnableLogging();
70
71 UUID userId = TestHelpers.ParseTail(0x1);
72
73// TestEventQueueGetModule eqmA = new TestEventQueueGetModule();
74 EntityTransferModule etmA = new EntityTransferModule();
75 EntityTransferModule etmB = new EntityTransferModule();
76 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
77
78 IConfigSource config = new IniConfigSource();
79 IConfig modulesConfig = config.AddConfig("Modules");
80 modulesConfig.Set("EntityTransferModule", etmA.Name);
81 modulesConfig.Set("SimulationServices", lscm.Name);
82// IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
83
84 // In order to run a single threaded regression test we do not want the entity transfer module waiting
85 // for a callback from the destination scene before removing its avatar data.
86// entityTransferConfig.Set("wait_for_callback", false);
87
88 SceneHelpers sh = new SceneHelpers();
89 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
90 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
91
92 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
93 SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
94// SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA);
95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
96
97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
98 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager);
99 List<TestClient> destinationTestClients = new List<TestClient>();
100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
101
102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager);
103 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
104
105// originalSp.Flying = true;
106
107// Console.WriteLine("First pos {0}", originalSp.AbsolutePosition);
108
109// eqmA.ClearEvents();
110
111 AgentUpdateArgs moveArgs = new AgentUpdateArgs();
112 //moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
113 moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
114 moveArgs.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_AT_POS;
115
116 originalSp.HandleAgentUpdate(originalSp.ControllingClient, moveArgs);
117
118 sceneA.Update(1);
119
120// Console.WriteLine("Second pos {0}", originalSp.AbsolutePosition);
121
122 // FIXME: This is a sufficient number of updates to for the presence to reach the northern border.
123 // But really we want to do this in a more robust way.
124 for (int i = 0; i < 100; i++)
125 {
126 sceneA.Update(1);
127// Console.WriteLine("Pos {0}", originalSp.AbsolutePosition);
128 }
129
130 // Need to sort processing of EnableSimulator message on adding scene presences before we can test eqm
131 // messages
132// Dictionary<UUID, List<TestEventQueueGetModule.Event>> eqmEvents = eqmA.Events;
133//
134// Assert.That(eqmEvents.Count, Is.EqualTo(1));
135// Assert.That(eqmEvents.ContainsKey(originalSp.UUID), Is.True);
136//
137// List<TestEventQueueGetModule.Event> spEqmEvents = eqmEvents[originalSp.UUID];
138//
139// Assert.That(spEqmEvents.Count, Is.EqualTo(1));
140// Assert.That(spEqmEvents[0].Name, Is.EqualTo("CrossRegion"));
141
142 // sceneA should now only have a child agent
143 ScenePresence spAfterCrossSceneA = sceneA.GetScenePresence(originalSp.UUID);
144 Assert.That(spAfterCrossSceneA.IsChildAgent, Is.True);
145
146 ScenePresence spAfterCrossSceneB = sceneB.GetScenePresence(originalSp.UUID);
147
148 // Agent remains a child until the client triggers complete movement
149 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True);
150
151 TestClient sceneBTc = ((TestClient)spAfterCrossSceneB.ControllingClient);
152
153 int agentMovementCompleteReceived = 0;
154 sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => agentMovementCompleteReceived++;
155
156 sceneBTc.CompleteMovement();
157
158 Assert.That(agentMovementCompleteReceived, Is.EqualTo(1));
159 Assert.That(spAfterCrossSceneB.IsChildAgent, Is.False);
160 }
161 }
162} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
index 493ab70..acaeb90 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs
@@ -43,7 +43,7 @@ using System.Threading;
43namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
44{ 44{
45 [TestFixture] 45 [TestFixture]
46 public class ScenePresenceSitTests 46 public class ScenePresenceSitTests : OpenSimTestCase
47 { 47 {
48 private TestScene m_scene; 48 private TestScene m_scene;
49 private ScenePresence m_sp; 49 private ScenePresence m_sp;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 37b5184..de4458d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -26,7 +26,10 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Reflection; 29using System.Collections.Generic;
30using System.IO;
31using System.Net;
32using System.Text;
30using Nini.Config; 33using Nini.Config;
31using NUnit.Framework; 34using NUnit.Framework;
32using OpenMetaverse; 35using OpenMetaverse;
@@ -40,8 +43,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
40using OpenSim.Region.CoreModules.World.Permissions; 43using OpenSim.Region.CoreModules.World.Permissions;
41using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock; 45using OpenSim.Tests.Common.Mock;
43using System.IO;
44using System.Text;
45 46
46namespace OpenSim.Region.Framework.Scenes.Tests 47namespace OpenSim.Region.Framework.Scenes.Tests
47{ 48{
@@ -49,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
49 /// Teleport tests in a standalone OpenSim 50 /// Teleport tests in a standalone OpenSim
50 /// </summary> 51 /// </summary>
51 [TestFixture] 52 [TestFixture]
52 public class ScenePresenceTeleportTests 53 public class ScenePresenceTeleportTests : OpenSimTestCase
53 { 54 {
54 [TestFixtureSetUp] 55 [TestFixtureSetUp]
55 public void FixtureInit() 56 public void FixtureInit()
@@ -68,7 +69,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
68 } 69 }
69 70
70 [Test] 71 [Test]
71 public void TestSameRegionTeleport() 72 public void TestSameRegion()
72 { 73 {
73 TestHelpers.InMethod(); 74 TestHelpers.InMethod();
74// log4net.Config.XmlConfigurator.Configure(); 75// log4net.Config.XmlConfigurator.Configure();
@@ -106,10 +107,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
106 } 107 }
107 108
108 [Test] 109 [Test]
109 public void TestSameSimulatorSeparatedRegionsTeleport() 110 public void TestSameSimulatorIsolatedRegions()
110 { 111 {
111 TestHelpers.InMethod(); 112 TestHelpers.InMethod();
112// log4net.Config.XmlConfigurator.Configure(); 113// TestHelpers.EnableLogging();
113 114
114 UUID userId = TestHelpers.ParseTail(0x1); 115 UUID userId = TestHelpers.ParseTail(0x1);
115 116
@@ -141,9 +142,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
141 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 142 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
142 sp.AbsolutePosition = new Vector3(30, 31, 32); 143 sp.AbsolutePosition = new Vector3(30, 31, 32);
143 144
144 // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole 145 List<TestClient> destinationTestClients = new List<TestClient>();
145 // UDP stack (?) 146 EntityTransferHelpers.SetUpInformClientOfNeighbour((TestClient)sp.ControllingClient, destinationTestClients);
146// ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB;
147 147
148 sceneA.RequestTeleportLocation( 148 sceneA.RequestTeleportLocation(
149 sp.ControllingClient, 149 sp.ControllingClient,
@@ -152,7 +152,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
152 teleportLookAt, 152 teleportLookAt,
153 (uint)TeleportFlags.ViaLocation); 153 (uint)TeleportFlags.ViaLocation);
154 154
155 ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); 155 // SetupInformClientOfNeighbour() will have handled the callback into the target scene to setup the child
156 // agent. This call will now complete the movement of the user into the destination and upgrade the agent
157 // from child to root.
158 destinationTestClients[0].CompleteMovement();
156 159
157 Assert.That(sceneA.GetScenePresence(userId), Is.Null); 160 Assert.That(sceneA.GetScenePresence(userId), Is.Null);
158 161
@@ -177,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
177 /// Test teleport procedures when the target simulator returns false when queried about access. 180 /// Test teleport procedures when the target simulator returns false when queried about access.
178 /// </summary> 181 /// </summary>
179 [Test] 182 [Test]
180 public void TestSameSimulatorSeparatedRegionsQueryAccessFails() 183 public void TestSameSimulatorIsolatedRegions_DeniedOnQueryAccess()
181 { 184 {
182 TestHelpers.InMethod(); 185 TestHelpers.InMethod();
183// TestHelpers.EnableLogging(); 186// TestHelpers.EnableLogging();
@@ -261,7 +264,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
261 /// Test teleport procedures when the target simulator create agent step is refused. 264 /// Test teleport procedures when the target simulator create agent step is refused.
262 /// </summary> 265 /// </summary>
263 [Test] 266 [Test]
264 public void TestSameSimulatorSeparatedRegionsCreateAgentFails() 267 public void TestSameSimulatorIsolatedRegions_DeniedOnCreateAgent()
265 { 268 {
266 TestHelpers.InMethod(); 269 TestHelpers.InMethod();
267// TestHelpers.EnableLogging(); 270// TestHelpers.EnableLogging();
@@ -333,13 +336,101 @@ namespace OpenSim.Region.Framework.Scenes.Tests
333// TestHelpers.DisableLogging(); 336// TestHelpers.DisableLogging();
334 } 337 }
335 338
339 /// <summary>
340 /// Test teleport when the destination region does not process (or does not receive) the connection attempt
341 /// from the viewer.
342 /// </summary>
343 /// <remarks>
344 /// This could be quite a common case where the source region can connect to a remove destination region
345 /// (for CreateAgent) but the viewer cannot reach the destination region due to network issues.
346 /// </remarks>
336 [Test] 347 [Test]
337 public void TestSameSimulatorNeighbouringRegionsTeleport() 348 public void TestSameSimulatorIsolatedRegions_DestinationDidNotProcessViewerConnection()
338 { 349 {
339 TestHelpers.InMethod(); 350 TestHelpers.InMethod();
340// TestHelpers.EnableLogging(); 351// TestHelpers.EnableLogging();
341 352
342 UUID userId = TestHelpers.ParseTail(0x1); 353 UUID userId = TestHelpers.ParseTail(0x1);
354 Vector3 preTeleportPosition = new Vector3(30, 31, 32);
355
356 EntityTransferModule etmA = new EntityTransferModule();
357 EntityTransferModule etmB = new EntityTransferModule();
358
359 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
360
361 IConfigSource config = new IniConfigSource();
362 config.AddConfig("Modules");
363 config.Configs["Modules"].Set("EntityTransferModule", etmA.Name);
364 config.Configs["Modules"].Set("SimulationServices", lscm.Name);
365
366 config.AddConfig("EntityTransfer");
367
368 // In order to run a single threaded regression test we do not want the entity transfer module waiting
369 // for a callback from the destination scene before removing its avatar data.
370 config.Configs["EntityTransfer"].Set("wait_for_callback", false);
371
372// config.AddConfig("Startup");
373// config.Configs["Startup"].Set("serverside_object_permissions", true);
374
375 SceneHelpers sh = new SceneHelpers();
376 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
377 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
378
379 SceneHelpers.SetupSceneModules(sceneA, config, etmA );
380
381 // We need to set up the permisions module on scene B so that our later use of agent limit to deny
382 // QueryAccess won't succeed anyway because administrators are always allowed in and the default
383 // IsAdministrator if no permissions module is present is true.
384 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB });
385
386 // Shared scene modules
387 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
388
389 Vector3 teleportPosition = new Vector3(10, 11, 12);
390 Vector3 teleportLookAt = new Vector3(20, 21, 22);
391
392 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
393 sp.AbsolutePosition = preTeleportPosition;
394
395 sceneA.RequestTeleportLocation(
396 sp.ControllingClient,
397 sceneB.RegionInfo.RegionHandle,
398 teleportPosition,
399 teleportLookAt,
400 (uint)TeleportFlags.ViaLocation);
401
402 // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate
403 // communication with the destination region. But this is a very non-obvious way of doing it - really we
404 // should be forced to expicitly set this up.
405
406 Assert.That(sceneB.GetScenePresence(userId), Is.Null);
407
408 ScenePresence sceneASp = sceneA.GetScenePresence(userId);
409 Assert.That(sceneASp, Is.Not.Null);
410 Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
411 Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
412
413 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1));
414 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
415 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0));
416 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
417
418 // TODO: Add assertions to check correct circuit details in both scenes.
419
420 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
421 // position instead).
422// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
423
424// TestHelpers.DisableLogging();
425 }
426
427 [Test]
428 public void TestSameSimulatorNeighbouringRegions()
429 {
430 TestHelpers.InMethod();
431 TestHelpers.EnableLogging();
432
433 UUID userId = TestHelpers.ParseTail(0x1);
343 434
344 EntityTransferModule etmA = new EntityTransferModule(); 435 EntityTransferModule etmA = new EntityTransferModule();
345 EntityTransferModule etmB = new EntityTransferModule(); 436 EntityTransferModule etmB = new EntityTransferModule();
@@ -366,10 +457,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
366 Vector3 teleportPosition = new Vector3(10, 11, 12); 457 Vector3 teleportPosition = new Vector3(10, 11, 12);
367 Vector3 teleportLookAt = new Vector3(20, 21, 22); 458 Vector3 teleportLookAt = new Vector3(20, 21, 22);
368 459
369 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 460 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
370 originalSp.AbsolutePosition = new Vector3(30, 31, 32); 461 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager);
462 List<TestClient> destinationTestClients = new List<TestClient>();
463 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
464
465 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager);
466 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
371 467
372 ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId);
373 Assert.That(beforeSceneASp, Is.Not.Null); 468 Assert.That(beforeSceneASp, Is.Not.Null);
374 Assert.That(beforeSceneASp.IsChildAgent, Is.False); 469 Assert.That(beforeSceneASp.IsChildAgent, Is.False);
375 470
@@ -377,10 +472,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
377 Assert.That(beforeSceneBSp, Is.Not.Null); 472 Assert.That(beforeSceneBSp, Is.Not.Null);
378 Assert.That(beforeSceneBSp.IsChildAgent, Is.True); 473 Assert.That(beforeSceneBSp.IsChildAgent, Is.True);
379 474
380 // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole 475 // In this case, we will not receieve a second InformClientOfNeighbour since the viewer already knows
381 // UDP stack (?) 476 // about the neighbour region it is teleporting to.
382// ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB;
383
384 sceneA.RequestTeleportLocation( 477 sceneA.RequestTeleportLocation(
385 beforeSceneASp.ControllingClient, 478 beforeSceneASp.ControllingClient,
386 sceneB.RegionInfo.RegionHandle, 479 sceneB.RegionInfo.RegionHandle,
@@ -388,7 +481,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
388 teleportLookAt, 481 teleportLookAt,
389 (uint)TeleportFlags.ViaLocation); 482 (uint)TeleportFlags.ViaLocation);
390 483
391 ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); 484 destinationTestClients[0].CompleteMovement();
392 485
393 ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); 486 ScenePresence afterSceneASp = sceneA.GetScenePresence(userId);
394 Assert.That(afterSceneASp, Is.Not.Null); 487 Assert.That(afterSceneASp, Is.Not.Null);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index ac3da1e..9d8eb0b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
50 /// Scene presence tests 50 /// Scene presence tests
51 /// </summary> 51 /// </summary>
52 [TestFixture] 52 [TestFixture]
53 public class SceneTests 53 public class SceneTests : OpenSimTestCase
54 { 54 {
55 /// <summary> 55 /// <summary>
56 /// Very basic scene update test. Should become more elaborate with time. 56 /// Very basic scene update test. Should become more elaborate with time.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index a51e4e3..6e0ea7d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -50,7 +50,7 @@ using OpenSim.Tests.Common.Mock;
50namespace OpenSim.Region.Framework.Tests 50namespace OpenSim.Region.Framework.Tests
51{ 51{
52 [TestFixture] 52 [TestFixture]
53 public class TaskInventoryTests 53 public class TaskInventoryTests : OpenSimTestCase
54 { 54 {
55 [Test] 55 [Test]
56 public void TestAddTaskInventoryItem() 56 public void TestAddTaskInventoryItem()
@@ -130,10 +130,10 @@ namespace OpenSim.Region.Framework.Tests
130 SceneObjectPart sop1 = sog1.RootPart; 130 SceneObjectPart sop1 = sog1.RootPart;
131 TaskInventoryItem sopItem1 131 TaskInventoryItem sopItem1
132 = TaskInventoryHelpers.AddNotecard( 132 = TaskInventoryHelpers.AddNotecard(
133 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); 133 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
134 134
135 InventoryFolderBase folder 135 InventoryFolderBase folder
136 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; 136 = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
137 137
138 // Perform test 138 // Perform test
139 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); 139 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID);
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
162 SceneObjectPart sop1 = sog1.RootPart; 162 SceneObjectPart sop1 = sog1.RootPart;
163 TaskInventoryItem sopItem1 163 TaskInventoryItem sopItem1
164 = TaskInventoryHelpers.AddNotecard( 164 = TaskInventoryHelpers.AddNotecard(
165 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); 165 scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
166 166
167 // Perform test 167 // Perform test
168 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); 168 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
index 9457ebb..e50b4da 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Tests
64 Scene scene = new SceneHelpers().SetupScene(); 64 Scene scene = new SceneHelpers().SetupScene();
65 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); 65 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
66 66
67 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); 67 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false);
68 68
69 List<InventoryFolderBase> oneFolder 69 List<InventoryFolderBase> oneFolder
70 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); 70 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Tests
73 InventoryFolderBase firstRetrievedFolder = oneFolder[0]; 73 InventoryFolderBase firstRetrievedFolder = oneFolder[0];
74 Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); 74 Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName));
75 75
76 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); 76 UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName, false);
77 77
78 List<InventoryFolderBase> twoFolders 78 List<InventoryFolderBase> twoFolders
79 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); 79 = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName);
@@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Tests
121 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); 121 UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001));
122 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); 122 UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002));
123 InventoryFolderBase folder1 123 InventoryFolderBase folder1
124 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1"); 124 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, "folder1", false);
125 125
126 scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); 126 scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero);
127 127
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 198e487..dd27294 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -38,7 +38,7 @@ using OpenSim.Tests.Common.Mock;
38namespace OpenSim.Region.Framework.Scenes.Tests 38namespace OpenSim.Region.Framework.Scenes.Tests
39{ 39{
40 [TestFixture] 40 [TestFixture]
41 public class UuidGathererTests 41 public class UuidGathererTests : OpenSimTestCase
42 { 42 {
43 protected IAssetService m_assetService; 43 protected IAssetService m_assetService;
44 protected UuidGatherer m_uuidGatherer; 44 protected UuidGatherer m_uuidGatherer;