diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests')
4 files changed, 109 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 3398a53..5b334c6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Threading; | 31 | using System.Threading; |
31 | using NUnit.Framework; | 32 | using NUnit.Framework; |
@@ -33,6 +34,7 @@ using OpenMetaverse; | |||
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 35 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Tests.Common; | 38 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 39 | using OpenSim.Tests.Common.Mock; |
38 | 40 | ||
@@ -42,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
42 | /// Basic scene object tests (create, read and delete but not update). | 44 | /// Basic scene object tests (create, read and delete but not update). |
43 | /// </summary> | 45 | /// </summary> |
44 | [TestFixture] | 46 | [TestFixture] |
45 | public class SceneObjectBasicTests | 47 | public class SceneObjectBasicTests : OpenSimTestCase |
46 | { | 48 | { |
47 | // [TearDown] | 49 | // [TearDown] |
48 | // public void TearDown() | 50 | // public void TearDown() |
@@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
237 | /// <summary> | 239 | /// <summary> |
238 | /// Test deleting an object asynchronously to user inventory. | 240 | /// Test deleting an object asynchronously to user inventory. |
239 | /// </summary> | 241 | /// </summary> |
240 | //[Test] | 242 | // [Test] |
241 | //public void TestDeleteSceneObjectAsyncToUserInventory() | 243 | public void TestDeleteSceneObjectAsyncToUserInventory() |
242 | //{ | 244 | { |
243 | // TestHelper.InMethod(); | 245 | TestHelpers.InMethod(); |
244 | // //log4net.Config.XmlConfigurator.Configure(); | 246 | TestHelpers.EnableLogging(); |
245 | 247 | ||
246 | // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | 248 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); |
247 | // string myObjectName = "Fred"; | 249 | string myObjectName = "Fred"; |
248 | 250 | ||
249 | // TestScene scene = SceneSetupHelpers.SetupScene(); | 251 | TestScene scene = new SceneHelpers().SetupScene(); |
250 | // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); | 252 | |
251 | 253 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | |
252 | // Assert.That( | 254 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; |
253 | // scene.CommsManager.UserAdminService.AddUser( | 255 | sogd.Enabled = false; |
254 | // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | 256 | |
255 | // Is.EqualTo(agentId)); | 257 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId); |
256 | 258 | ||
257 | // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | 259 | // Assert.That( |
258 | 260 | // scene.CommsManager.UserAdminService.AddUser( | |
259 | // CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | 261 | // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), |
260 | // Assert.That(userInfo, Is.Not.Null); | 262 | // Is.EqualTo(agentId)); |
261 | // Assert.That(userInfo.RootFolder, Is.Not.Null); | 263 | |
262 | 264 | UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId); | |
263 | // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | 265 | InventoryFolderBase folder1 |
264 | 266 | = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1"); | |
265 | // // Check that we now have the taken part in our inventory | 267 | |
266 | // Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); | 268 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; |
267 | 269 | scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID); | |
268 | // // Check that the taken part has actually disappeared | 270 | |
269 | // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | 271 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); |
270 | // Assert.That(retrievedPart, Is.Null); | 272 | |
271 | //} | 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 | } | ||
272 | 296 | ||
273 | /// <summary> | 297 | /// <summary> |
274 | /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not | 298 | /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 5758869..5faf131 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | |||
@@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
141 | TestScene scene = new SceneHelpers().SetupScene(); | 141 | TestScene scene = new SceneHelpers().SetupScene(); |
142 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | 142 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); |
143 | 143 | ||
144 | scene.IncomingCloseAgent(sp.UUID); | 144 | scene.IncomingCloseAgent(sp.UUID, false); |
145 | 145 | ||
146 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); | 146 | Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); |
147 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); | 147 | Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index d722a09..ac3da1e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs | |||
@@ -65,5 +65,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
65 | 65 | ||
66 | Assert.That(scene.Frame, Is.EqualTo(1)); | 66 | Assert.That(scene.Frame, Is.EqualTo(1)); |
67 | } | 67 | } |
68 | |||
69 | [Test] | ||
70 | public void TestShutdownScene() | ||
71 | { | ||
72 | TestHelpers.InMethod(); | ||
73 | |||
74 | Scene scene = new SceneHelpers().SetupScene(); | ||
75 | scene.Close(); | ||
76 | |||
77 | Assert.That(scene.ShuttingDown, Is.True); | ||
78 | Assert.That(scene.Active, Is.False); | ||
79 | |||
80 | // Trying to update a shutdown scene should result in no update | ||
81 | scene.Update(1); | ||
82 | |||
83 | Assert.That(scene.Frame, Is.EqualTo(0)); | ||
84 | } | ||
68 | } | 85 | } |
69 | } \ No newline at end of file | 86 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 44d2d45..9457ebb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs | |||
@@ -50,9 +50,41 @@ using OpenSim.Tests.Common.Mock; | |||
50 | namespace OpenSim.Region.Framework.Tests | 50 | namespace OpenSim.Region.Framework.Tests |
51 | { | 51 | { |
52 | [TestFixture] | 52 | [TestFixture] |
53 | public class UserInventoryTests | 53 | public class UserInventoryTests : OpenSimTestCase |
54 | { | 54 | { |
55 | [Test] | 55 | [Test] |
56 | public void TestCreateInventoryFolders() | ||
57 | { | ||
58 | TestHelpers.InMethod(); | ||
59 | // TestHelpers.EnableLogging(); | ||
60 | |||
61 | // For this test both folders will have the same name which is legal in SL user inventories. | ||
62 | string foldersName = "f1"; | ||
63 | |||
64 | Scene scene = new SceneHelpers().SetupScene(); | ||
65 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | ||
66 | |||
67 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | ||
68 | |||
69 | List<InventoryFolderBase> oneFolder | ||
70 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | ||
71 | |||
72 | Assert.That(oneFolder.Count, Is.EqualTo(1)); | ||
73 | InventoryFolderBase firstRetrievedFolder = oneFolder[0]; | ||
74 | Assert.That(firstRetrievedFolder.Name, Is.EqualTo(foldersName)); | ||
75 | |||
76 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, user1.PrincipalID, foldersName); | ||
77 | |||
78 | List<InventoryFolderBase> twoFolders | ||
79 | = UserInventoryHelpers.GetInventoryFolders(scene.InventoryService, user1.PrincipalID, foldersName); | ||
80 | |||
81 | Assert.That(twoFolders.Count, Is.EqualTo(2)); | ||
82 | Assert.That(twoFolders[0].Name, Is.EqualTo(foldersName)); | ||
83 | Assert.That(twoFolders[1].Name, Is.EqualTo(foldersName)); | ||
84 | Assert.That(twoFolders[0].ID, Is.Not.EqualTo(twoFolders[1].ID)); | ||
85 | } | ||
86 | |||
87 | [Test] | ||
56 | public void TestGiveInventoryItem() | 88 | public void TestGiveInventoryItem() |
57 | { | 89 | { |
58 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
@@ -83,7 +115,7 @@ namespace OpenSim.Region.Framework.Tests | |||
83 | public void TestGiveInventoryFolder() | 115 | public void TestGiveInventoryFolder() |
84 | { | 116 | { |
85 | TestHelpers.InMethod(); | 117 | TestHelpers.InMethod(); |
86 | // log4net.Config.XmlConfigurator.Configure(); | 118 | // TestHelpers.EnableLogging(); |
87 | 119 | ||
88 | Scene scene = new SceneHelpers().SetupScene(); | 120 | Scene scene = new SceneHelpers().SetupScene(); |
89 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); | 121 | UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); |