From 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 19 May 2019 21:24:15 +1000 Subject: Dump OpenSim 0.9.0.1 into it's own branch. --- .../Region/Framework/Scenes/Tests/BorderTests.cs | 340 --------------------- .../Framework/Scenes/Tests/EntityManagerTests.cs | 22 +- .../Framework/Scenes/Tests/SceneGraphTests.cs | 20 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 39 +-- .../Framework/Scenes/Tests/SceneObjectCopyTests.cs | 34 ++- .../Scenes/Tests/SceneObjectCrossingTests.cs | 51 +++- .../Scenes/Tests/SceneObjectDeRezTests.cs | 71 +++-- .../Scenes/Tests/SceneObjectLinkingTests.cs | 56 ++-- .../Scenes/Tests/SceneObjectResizeTests.cs | 6 +- .../Scenes/Tests/SceneObjectSpatialTests.cs | 3 +- .../Scenes/Tests/SceneObjectStatusTests.cs | 16 +- .../Scenes/Tests/SceneObjectUndoRedoTests.cs | 4 +- .../Scenes/Tests/SceneObjectUserGroupTests.cs | 37 +-- .../Scenes/Tests/ScenePresenceAgentTests.cs | 15 +- .../Scenes/Tests/ScenePresenceAnimationTests.cs | 2 +- .../Scenes/Tests/ScenePresenceAutopilotTests.cs | 4 +- .../Scenes/Tests/ScenePresenceCapabilityTests.cs | 8 +- .../Scenes/Tests/ScenePresenceCrossingTests.cs | 8 +- .../Scenes/Tests/ScenePresenceSitTests.cs | 4 +- .../Scenes/Tests/ScenePresenceTeleportTests.cs | 10 +- .../Framework/Scenes/Tests/SceneStatisticsTests.cs | 2 +- .../Framework/Scenes/Tests/SceneTelehubTests.cs | 4 +- .../Region/Framework/Scenes/Tests/SceneTests.cs | 4 +- .../Scenes/Tests/SharedRegionModuleTests.cs | 18 +- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 22 +- .../Framework/Scenes/Tests/UserInventoryTests.cs | 68 ++++- .../Framework/Scenes/Tests/UuidGathererTests.cs | 18 +- 27 files changed, 320 insertions(+), 566 deletions(-) delete mode 100644 OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs (limited to 'OpenSim/Region/Framework/Scenes/Tests') diff --git a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs b/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs deleted file mode 100644 index e209221..0000000 --- a/OpenSim/Region/Framework/Scenes/Tests/BorderTests.cs +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using NUnit.Framework; -using OpenMetaverse; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Tests.Common; - -namespace OpenSim.Region.Framework.Scenes.Tests -{ - [TestFixture] - public class BorderTests : OpenSimTestCase - { - [Test] - public void TestCross() - { - TestHelpers.InMethod(); - - List testborders = new List(); - - Border NorthBorder = new Border(); - NorthBorder.BorderLine = new Vector3(0, 256, 256); //<--- - NorthBorder.CrossDirection = Cardinals.N; - testborders.Add(NorthBorder); - - Border SouthBorder = new Border(); - SouthBorder.BorderLine = new Vector3(0, 256, 0); //---> - SouthBorder.CrossDirection = Cardinals.S; - testborders.Add(SouthBorder); - - Border EastBorder = new Border(); - EastBorder.BorderLine = new Vector3(0, 256, 256); //<--- - EastBorder.CrossDirection = Cardinals.E; - testborders.Add(EastBorder); - - Border WestBorder = new Border(); - WestBorder.BorderLine = new Vector3(0, 256, 0); //---> - WestBorder.CrossDirection = Cardinals.W; - testborders.Add(WestBorder); - - Vector3 position = new Vector3(200,200,21); - - foreach (Border b in testborders) - Assert.That(!b.TestCross(position)); - - position = new Vector3(200,280,21); - Assert.That(NorthBorder.TestCross(position)); - - // Test automatic border crossing - // by setting the border crossing aabb to be the whole region - position = new Vector3(25,25,21); // safely within one 256m region - - // The Z value of the BorderLine is reversed, making all positions within the region - // trigger bordercross - - SouthBorder.BorderLine = new Vector3(0,256,256); // automatic border cross in the region - Assert.That(SouthBorder.TestCross(position)); - - NorthBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region - Assert.That(NorthBorder.TestCross(position)); - - EastBorder.BorderLine = new Vector3(0, 256, 0); // automatic border cross in the region - Assert.That(EastBorder.TestCross(position)); - - WestBorder.BorderLine = new Vector3(0, 256, 255); // automatic border cross in the region - Assert.That(WestBorder.TestCross(position)); - } - - [Test] - public void TestCrossSquare512() - { - TestHelpers.InMethod(); - - List testborders = new List(); - - Border NorthBorder = new Border(); - NorthBorder.BorderLine = new Vector3(0, 512, 512); - NorthBorder.CrossDirection = Cardinals.N; - testborders.Add(NorthBorder); - - Border SouthBorder = new Border(); - SouthBorder.BorderLine = new Vector3(0, 512, 0); - SouthBorder.CrossDirection = Cardinals.S; - testborders.Add(SouthBorder); - - Border EastBorder = new Border(); - EastBorder.BorderLine = new Vector3(0, 512, 512); - EastBorder.CrossDirection = Cardinals.E; - testborders.Add(EastBorder); - - Border WestBorder = new Border(); - WestBorder.BorderLine = new Vector3(0, 512, 0); - WestBorder.CrossDirection = Cardinals.W; - testborders.Add(WestBorder); - - Vector3 position = new Vector3(450,220,21); - - foreach (Border b in testborders) - { - Assert.That(!b.TestCross(position)); - - } - - //Trigger east border - position = new Vector3(513,220,21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.E) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger west border - position = new Vector3(-1, 220, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.W) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger north border - position = new Vector3(220, 513, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.N) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger south border - position = new Vector3(220, -1, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.S) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - } - - [Test] - public void TestCrossRectangle512x256() - { - TestHelpers.InMethod(); - - List testborders = new List(); - - Border NorthBorder = new Border(); - NorthBorder.BorderLine = new Vector3(0, 512, 256); - NorthBorder.CrossDirection = Cardinals.N; - testborders.Add(NorthBorder); - - Border SouthBorder = new Border(); - SouthBorder.BorderLine = new Vector3(0, 512, 0); - SouthBorder.CrossDirection = Cardinals.S; - testborders.Add(SouthBorder); - - Border EastBorder = new Border(); - EastBorder.BorderLine = new Vector3(0, 256, 512); - EastBorder.CrossDirection = Cardinals.E; - testborders.Add(EastBorder); - - Border WestBorder = new Border(); - WestBorder.BorderLine = new Vector3(0, 256, 0); - WestBorder.CrossDirection = Cardinals.W; - testborders.Add(WestBorder); - - Vector3 position = new Vector3(450, 220, 21); - - foreach (Border b in testborders) - { - Assert.That(!b.TestCross(position)); - - } - - //Trigger east border - position = new Vector3(513, 220, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.E) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger west border - position = new Vector3(-1, 220, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.W) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger north border - position = new Vector3(220, 257, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.N) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - - //Trigger south border - position = new Vector3(220, -1, 21); - foreach (Border b in testborders) - { - if (b.CrossDirection == Cardinals.S) - Assert.That(b.TestCross(position)); - else - Assert.That(!b.TestCross(position)); - - } - } - - [Test] - public void TestCrossOdd512x512w256hole() - { - TestHelpers.InMethod(); - - List testborders = new List(); - // 512____ - // | | - // 256__| |___ - // | | - // |______| - // 0 | 512 - // 256 - - // Compound North border since the hole is at the top - Border NorthBorder1 = new Border(); - NorthBorder1.BorderLine = new Vector3(0, 256, 512); - NorthBorder1.CrossDirection = Cardinals.N; - testborders.Add(NorthBorder1); - - Border NorthBorder2 = new Border(); - NorthBorder2.BorderLine = new Vector3(256, 512, 256); - NorthBorder2.CrossDirection = Cardinals.N; - testborders.Add(NorthBorder2); - - Border SouthBorder = new Border(); - SouthBorder.BorderLine = new Vector3(0, 512, 0); - SouthBorder.CrossDirection = Cardinals.S; - testborders.Add(SouthBorder); - - //Compound East border - Border EastBorder1 = new Border(); - EastBorder1.BorderLine = new Vector3(0, 256, 512); - EastBorder1.CrossDirection = Cardinals.E; - testborders.Add(EastBorder1); - - Border EastBorder2 = new Border(); - EastBorder2.BorderLine = new Vector3(257, 512, 256); - EastBorder2.CrossDirection = Cardinals.E; - testborders.Add(EastBorder2); - - - - Border WestBorder = new Border(); - WestBorder.BorderLine = new Vector3(0, 512, 0); - WestBorder.CrossDirection = Cardinals.W; - testborders.Add(WestBorder); - - Vector3 position = new Vector3(450, 220, 21); - - foreach (Border b in testborders) - { - Assert.That(!b.TestCross(position)); - - } - - position = new Vector3(220, 450, 21); - - foreach (Border b in testborders) - { - Assert.That(!b.TestCross(position)); - - } - - bool result = false; - int bordersTriggered = 0; - - position = new Vector3(450, 450, 21); - - foreach (Border b in testborders) - { - if (b.TestCross(position)) - { - bordersTriggered++; - result = true; - } - } - - Assert.That(result); - Assert.That(bordersTriggered == 2); - - } - } -} diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index da18941..fa698a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void T010_AddObjects() { TestHelpers.InMethod(); - + random = new Random(); SceneObjectGroup found; EntityManager entman = new EntityManager(); @@ -62,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID obj2 = sog.UUID; uint li2 = sog.LocalId; entman.Add(sog); - + found = (SceneObjectGroup)entman[obj1]; Assert.That(found.UUID ,Is.EqualTo(obj1)); found = (SceneObjectGroup)entman[li1]; @@ -85,15 +85,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void T011_ThreadAddRemoveTest() { TestHelpers.InMethod(); - - // This test adds and removes with mutiple threads, attempting to break the + + // This test adds and removes with mutiple threads, attempting to break the // uuid and localid dictionary coherence. EntityManager entman = new EntityManager(); SceneObjectGroup sog = NewSOG(); for (int j=0; j<20; j++) { List trdlist = new List(); - + for (int i=0; i<4; i++) { // Adds scene object @@ -101,14 +101,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests Thread start = new Thread(new ThreadStart(test.TestAddSceneObject)); start.Start(); trdlist.Add(start); - + // Removes it test = new NewTestThreads(entman,sog); start = new Thread(new ThreadStart(test.TestRemoveSceneObject)); start.Start(); trdlist.Add(start); } - foreach (Thread thread in trdlist) + foreach (Thread thread in trdlist) { thread.Join(); } @@ -133,14 +133,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup sog = new SceneObjectGroup(sop); scene.AddNewSceneObject(sog, false); - + return sog; } - + private static string RandomName() { StringBuilder name = new StringBuilder(); - int size = random.Next(40,80); + int size = random.Next(40,80); char ch ; for (int i=0; i /// Test deleting an object from a scene. /// @@ -194,18 +197,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); Assert.That(so.IsDeleted, Is.False); + uint retrievedPartID = so.LocalId; scene.DeleteSceneObject(so, false); - Assert.That(so.IsDeleted, Is.True); + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(retrievedPartID); - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); Assert.That(retrievedPart, Is.Null); } - + /// /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not - /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by + /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by /// OpenSim. /// [Test] @@ -215,24 +218,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); string childPartName = "childPart"; UUID childPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); - + SceneObjectPart rootPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = childPartName, UUID = childPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); sog.AddPart(linkPart); - + Assert.That(sog.UUID, Is.EqualTo(rootPartUuid)); Assert.That(sog.RootPart.UUID, Is.EqualTo(rootPartUuid)); Assert.That(sog.Parts.Length, Is.EqualTo(2)); - + UUID newRootPartUuid = new UUID("00000000-0000-0000-0000-000000000002"); sog.UUID = newRootPartUuid; - + Assert.That(sog.UUID, Is.EqualTo(newRootPartUuid)); Assert.That(sog.RootPart.UUID, Is.EqualTo(newRootPartUuid)); Assert.That(sog.Parts.Length, Is.EqualTo(2)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs index 0b196c1..c27bc1a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs @@ -42,6 +42,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests { + /* /// /// Test copying of scene objects. /// @@ -86,7 +87,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; + sogd.Enabled = false; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID); uint soLocalId = so.LocalId; @@ -118,11 +119,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1"); Assert.That(item, Is.Not.Null); } @@ -144,7 +145,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; + sogd.Enabled = false; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", ua.PrincipalID); uint soLocalId = so.LocalId; @@ -167,11 +168,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we do not have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Lost And Found/so1"); Assert.That(item, Is.Null); } @@ -193,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; + sogd.Enabled = false; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2)); uint soLocalId = so.LocalId; @@ -218,11 +219,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); Assert.That(item, Is.Not.Null); } @@ -244,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; + sogd.Enabled = false; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", TestHelpers.ParseTail(0x2)); uint soLocalId = so.LocalId; @@ -271,11 +272,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests sogd.InventoryDeQueueAndDelete(); // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); Assert.That(item, Is.Null); } @@ -302,11 +303,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests sogd.InventoryDeQueueAndDelete(); // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); Assert.That(item, Is.Null); } @@ -333,14 +334,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests sogd.InventoryDeQueueAndDelete(); // Check that object is still there. SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Not.Null); + Assert.That(retrievedPart2, Is.Not.Null); Assert.That(client.ReceivedKills.Count, Is.EqualTo(0)); // Check that we have a copy in inventory - InventoryItemBase item + InventoryItemBase item = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, ua.PrincipalID, "Objects/so1"); Assert.That(item, Is.Null); } } } + */ } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs index 5635c20..abf8c48 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCrossingTests.cs @@ -37,6 +37,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.World.Land; using OpenSim.Region.OptionalModules; using OpenSim.Tests.Common; +using System.Threading; namespace OpenSim.Region.Framework.Scenes.Tests { @@ -64,6 +65,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestCrossOnSameSimulator() { + TestHelpers.InMethod(); // TestHelpers.EnableLogging(); @@ -94,6 +96,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Cross with a negative value so1.AbsolutePosition = new Vector3(128, -10, 20); + // crossing is async + Thread.Sleep(500); + Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); } @@ -152,26 +157,28 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Cross sceneA.SceneGraph.UpdatePrimGroupPosition( - so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), userId); + so1.LocalId, new Vector3(so1StartPos.X, so1StartPos.Y - 20, so1StartPos.Z), sp1SceneA.ControllingClient); + + // crossing is async + Thread.Sleep(500); SceneObjectGroup so1PostCross; - { - ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); - Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); + ScenePresence sp1SceneAPostCross = sceneA.GetScenePresence(userId); + Assert.IsTrue(sp1SceneAPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly false"); - ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); - TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); - sceneBTc.CompleteMovement(); + ScenePresence sp1SceneBPostCross = sceneB.GetScenePresence(userId); + TestClient sceneBTc = ((TestClient)sp1SceneBPostCross.ControllingClient); + sceneBTc.CompleteMovement(); - Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); - Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); + Assert.IsFalse(sp1SceneBPostCross.IsChildAgent, "sp1SceneAPostCross.IsChildAgent unexpectedly true"); + Assert.IsTrue(sp1SceneBPostCross.IsSatOnObject); + + Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); + so1PostCross = sceneB.GetSceneObjectGroup(so1Id); + Assert.NotNull(so1PostCross); + Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); - Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id), "uck"); - so1PostCross = sceneB.GetSceneObjectGroup(so1Id); - Assert.NotNull(so1PostCross); - Assert.AreEqual(1, so1PostCross.GetSittingAvatarsCount()); - } Vector3 so1PostCrossPos = so1PostCross.AbsolutePosition; @@ -179,7 +186,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Recross sceneB.SceneGraph.UpdatePrimGroupPosition( - so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), userId); + so1PostCross.LocalId, new Vector3(so1PostCrossPos.X, so1PostCrossPos.Y + 20, so1PostCrossPos.Z), sp1SceneBPostCross.ControllingClient); + + // crossing is async + Thread.Sleep(500); { ScenePresence sp1SceneBPostReCross = sceneB.GetScenePresence(userId); @@ -244,13 +254,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests lmmA.EventManagerOnNoLandDataFromStorage(); lmmB.EventManagerOnNoLandDataFromStorage(); + AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); + TestClient tc = new TestClient(acd, sceneA); + List destinationTestClients = new List(); + EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); + ScenePresence sp1SceneA = SceneHelpers.AddScenePresence(sceneA, tc, acd); + SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail); UUID so1Id = so1.UUID; so1.AbsolutePosition = new Vector3(128, 10, 20); // Cross with a negative value. We must make this call rather than setting AbsolutePosition directly // because only this will execute permission checks in the source region. - sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), userId); + sceneA.SceneGraph.UpdatePrimGroupPosition(so1.LocalId, new Vector3(128, -10, 20), sp1SceneA.ControllingClient); + + // crossing is async + Thread.Sleep(500); Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id)); Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index 1c396ac..b84ecac 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -77,16 +77,19 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestDeRezSceneObject() { TestHelpers.InMethod(); - + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - + TestScene scene = new SceneHelpers().SetupScene(); - SceneHelpers.SetupSceneModules(scene, new PermissionsModule()); - TestClient client = (TestClient)SceneHelpers.AddScenePresence(scene, userId).ControllingClient; - + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() }); + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; + sogd.Enabled = false; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, "so1", userId); uint soLocalId = so.LocalId; @@ -97,16 +100,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Check that object isn't deleted until we crank the sogd handle. SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart, Is.Not.Null); - Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); +// Assert.That(retrievedPart, Is.Not.Null); +// Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False); sogd.InventoryDeQueueAndDelete(); - - SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart2, Is.Null); - Assert.That(client.ReceivedKills.Count, Is.EqualTo(1)); - Assert.That(client.ReceivedKills[0], Is.EqualTo(soLocalId)); +// SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); + Assert.That(retrievedPart, Is.Null); } /// @@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.SetupSceneModules(sceneB, config, etmB); // We need this for derez - SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule()); + //SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule()); UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, ""); UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, ""); @@ -153,52 +153,49 @@ namespace OpenSim.Region.Framework.Scenes.Tests uint soLocalId = so.LocalId; sceneA.DeleteSceneObject(so, false); - - Assert.That(clientA.ReceivedKills.Count, Is.EqualTo(1)); - Assert.That(clientA.ReceivedKills[0], Is.EqualTo(soLocalId)); - - Assert.That(childClientsB[0].ReceivedKills.Count, Is.EqualTo(1)); - Assert.That(childClientsB[0].ReceivedKills[0], Is.EqualTo(soLocalId)); } - + /// /// Test deleting an object from a scene where the deleter is not the owner /// /// - /// This test assumes that the deleter is not a god. + /// This test assumes that the deleter is not a god. /// [Test] public void TestDeRezSceneObjectNotOwner() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); - + TestScene scene = new SceneHelpers().SetupScene(); - SceneHelpers.SetupSceneModules(scene, new PermissionsModule()); + IConfigSource configSource = new IniConfigSource(); + IConfig config = configSource.AddConfig("Startup"); + config.Set("serverside_object_permissions", true); + SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new DefaultPermissionsModule() }); IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; - + // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; - sogd.Enabled = false; - + sogd.Enabled = false; + SceneObjectPart part = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); part.Name = "obj1"; scene.AddNewSceneObject(new SceneObjectGroup(part), false); List localIds = new List(); - localIds.Add(part.LocalId); + localIds.Add(part.LocalId); scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); sogd.InventoryDeQueueAndDelete(); - + // Object should still be in the scene. SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); - } - + } + /// /// Test deleting an object asynchronously to user inventory. /// @@ -214,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); - IConfig config = configSource.AddConfig("Modules"); + IConfig config = configSource.AddConfig("Modules"); config.Set("InventoryAccessModule", "BasicInventoryAccessModule"); SceneHelpers.SetupSceneModules( scene, configSource, new object[] { new BasicInventoryAccessModule() }); @@ -234,10 +231,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; scene.DeRezObjects(client, new List() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID); - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); +// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); - Assert.That(retrievedPart, Is.Not.Null); - Assert.That(so.IsDeleted, Is.False); +// Assert.That(retrievedPart, Is.Not.Null); +// Assert.That(so.IsDeleted, Is.False); sogd.InventoryDeQueueAndDelete(); @@ -260,4 +257,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(retrievedPart, Is.Null); } } -} \ 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 e6d5a2f..41f61ac 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -66,8 +66,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestLinkDelink2SceneObjects() { TestHelpers.InMethod(); - - bool debugtest = false; + + bool debugtest = false; Scene scene = new SceneHelpers().SetupScene(); SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // <180,0,0> grp2.UpdateGroupRotationR(Quaternion.CreateFromEulers(180 * Utils.DEG_TO_RAD, 0, 0)); - + // Required for linking grp1.RootPart.ClearUpdateSchedule(); grp2.RootPart.ClearUpdateSchedule(); @@ -111,7 +111,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests } // root part should have no offset position or rotation - Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity, + Assert.That(part1.OffsetPosition == Vector3.Zero && part1.RotationOffset == Quaternion.Identity, "root part should have no offset position or rotation"); // offset position should be root part position - part2.absolute position. @@ -125,13 +125,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests // There's a euler anomoly at 180, 0, 0 so expect 180 to turn into -180. part1.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); Vector3 rotEuler1 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); - + if (debugtest) m_log.Debug(rotEuler1); part2.RotationOffset.GetEulerAngles(out roll, out pitch, out yaw); Vector3 rotEuler2 = new Vector3(roll * Utils.RAD_TO_DEG, pitch * Utils.RAD_TO_DEG, yaw * Utils.RAD_TO_DEG); - + if (debugtest) m_log.Debug(rotEuler2); @@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestLinkDelink2groups4SceneObjects() { TestHelpers.InMethod(); - + bool debugtest = false; Scene scene = new SceneHelpers().SetupScene(); @@ -194,7 +194,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Link grp4 to grp3. grp3.LinkToGroup(grp4); - + // At this point we should have 4 parts total in two groups. Assert.That(grp1.Parts.Length == 2, "Group1 children count should be 2"); Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link."); @@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(grp3.Parts.Length == 2, "Group3 children count should be 2"); Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link."); Assert.That(grp4.Parts.Length, Is.EqualTo(0), "Group 4 still contained parts after delink."); - + if (debugtest) { m_log.Debug("--------After Link-------"); @@ -273,13 +273,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(part2.AbsolutePosition == Vector3.Zero, "Badness 1"); Assert.That(part4.OffsetPosition == new Vector3(20, 20, 20), "Badness 2"); Quaternion compareQuaternion = new Quaternion(0, 0.7071068f, 0, 0.7071068f); - Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003) - && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) - && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) + Assert.That((part4.RotationOffset.X - compareQuaternion.X < 0.00003) + && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) + && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), "Badness 3"); } - + /// /// Test that a new scene object which is already linked is correctly persisted to the persistence layer. /// @@ -288,37 +288,37 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - + TestScene scene = new SceneHelpers().SetupScene(); - + string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); string linkPartName = "linkpart"; UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); SceneObjectPart rootPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = rootPartName, UUID = rootPartUuid }; SceneObjectPart linkPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup sog = new SceneObjectGroup(rootPart); sog.AddPart(linkPart); scene.AddNewSceneObject(sog, true); - + // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked // scene backup thread. scene.Backup(true); - + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); - + Assert.That(storedObjects.Count, Is.EqualTo(1)); Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(2)); Assert.That(storedObjects[0].ContainsPart(rootPartUuid)); Assert.That(storedObjects[0].ContainsPart(linkPartUuid)); } - + /// /// Test that a delink of a previously linked object is correctly persisted to the database /// @@ -327,20 +327,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - + TestScene scene = new SceneHelpers().SetupScene(); - + string rootPartName = "rootpart"; UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); string linkPartName = "linkpart"; UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000"); SceneObjectPart rootPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = rootPartName, UUID = rootPartUuid }; - + SceneObjectPart linkPart - = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) + = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) { Name = linkPartName, UUID = linkPartUuid }; SceneObjectGroup linkGroup = new SceneObjectGroup(linkPart); scene.AddNewSceneObject(linkGroup, true); @@ -359,13 +359,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); Assert.IsFalse(groupToDelete.GroupContainsForeignPrims); +/* backup is async scene.DeleteSceneObject(groupToDelete, false); - + List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); Assert.AreEqual(1, storedObjects.Count); Assert.AreEqual(1, storedObjects[0].Parts.Length); Assert.IsTrue(storedObjects[0].ContainsPart(rootPartUuid)); +*/ } } } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 975c4d9..8b3a7e9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -60,6 +60,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(g1Post.RootPart.Scale.X, Is.EqualTo(2)); Assert.That(g1Post.RootPart.Scale.Y, Is.EqualTo(3)); Assert.That(g1Post.RootPart.Scale.Z, Is.EqualTo(4)); + +// Assert.That(g1Post.RootPart.UndoCount, Is.EqualTo(1)); } /// @@ -72,8 +74,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests //log4net.Config.XmlConfigurator.Configure(); Scene scene = new SceneHelpers().SetupScene(); - - SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, UUID.Zero); + UUID owner = UUID.Random(); + SceneObjectGroup g1 = SceneHelpers.CreateSceneObject(2, owner); g1.RootPart.Scale = new Vector3(2, 3, 4); g1.Parts[1].Scale = new Vector3(5, 6, 7); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index e00defd..c2c7822 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs @@ -138,8 +138,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneObjectPart childPart = so.Parts[1]; - // FIXME: Should be childPosition after rotation? - Assert.That(childPart.AbsolutePosition, Is.EqualTo(rootPartPosition + childOffsetPosition)); + Assert.That(childPart.AbsolutePosition, Is.EqualTo(childPosition)); Assert.That(childPart.GroupPosition, Is.EqualTo(rootPartPosition)); Assert.That(childPart.GetWorldPosition(), Is.EqualTo(childPosition)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 1737e3c..8d88083 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests m_so1.ScriptSetTemporaryStatus(false); Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.None)); - Assert.That(m_so1.Backup, Is.True); + Assert.That(m_so1.Backup, Is.True); } [Test] @@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests m_so1.ScriptSetPhantomStatus(false); - Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); } [Test] @@ -107,11 +107,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests m_so1.ScriptSetVolumeDetect(true); // Console.WriteLine("so.RootPart.Flags [{0}]", so.RootPart.Flags); - Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom)); + // PrimFlags.JointLP2P is incorrect it now means VolumeDetect (as defined by viewers) + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.JointLP2P)); m_so1.ScriptSetVolumeDetect(false); - Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); } [Test] @@ -146,13 +147,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests m_so1.ScriptSetPhysicsStatus(true); m_so1.ScriptSetVolumeDetect(true); - Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics)); + // PrimFlags.JointLP2P is incorrect it now means VolumeDetect (as defined by viewers) + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Phantom | PrimFlags.Physics | PrimFlags.JointLP2P)); m_so1.ScriptSetVolumeDetect(false); - Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); + Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.Physics)); } - + [Test] public void TestSetPhysicsLinkset() { diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index af3ce8e..340da9c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* undo has changed, this tests dont apply without large changes using System; using System.Reflection; using NUnit.Framework; @@ -179,4 +180,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(g1.GroupScale, Is.EqualTo(newSize)); } } -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index aadf7c6..4ec69cd 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -42,7 +42,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests { [TestFixture] - public class SceneObjectUserGroupTests : OpenSimTestCase + public class SceneObjectUserGroupTests { /// /// Test share with group object functionality @@ -52,31 +52,32 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestShareWithGroup() { TestHelpers.InMethod(); - +// log4net.Config.XmlConfigurator.Configure(); + UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); - + TestScene scene = new SceneHelpers().SetupScene(); IConfigSource configSource = new IniConfigSource(); - + IConfig startupConfig = configSource.AddConfig("Startup"); startupConfig.Set("serverside_object_permissions", true); - - IConfig groupsConfig = configSource.AddConfig("Groups"); + + IConfig groupsConfig = configSource.AddConfig("Groups"); groupsConfig.Set("Enabled", true); - groupsConfig.Set("Module", "GroupsModule"); - groupsConfig.Set("DebugEnabled", true); - + groupsConfig.Set("Module", "GroupsModule"); + groupsConfig.Set("DebugEnabled", true); + SceneHelpers.SetupSceneModules( - scene, configSource, new object[] - { new PermissionsModule(), - new GroupsModule(), + scene, configSource, new object[] + { new DefaultPermissionsModule(), + new GroupsModule(), new MockGroupsServicesConnector() }); - - IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; - - IGroupsModule groupsModule = scene.RequestModuleInterface(); - + + IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; + + IGroupsModule groupsModule = scene.RequestModuleInterface(); + groupsModule.CreateGroup(client, "group1", "To boldly go", true, UUID.Zero, 5, true, true, true); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 96d112d..0f386bc 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -44,6 +44,7 @@ using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Tests.Common; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes.Tests { @@ -141,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Check rest of exepcted parameters. Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); - + Assert.That(sp.IsChildAgent, Is.False); Assert.That(sp.UUID, Is.EqualTo(spUuid)); @@ -226,7 +227,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests // *** This is the first stage, when a neighbouring region is told that a viewer is about to try and // establish a child scene presence. We pass in the circuit code that the client has to connect with *** // XXX: ViaLogin may not be correct here. - scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, out reason); + EntityTransferContext ctx = new EntityTransferContext(); + scene.SimulationService.CreateAgent(null, region, acd, (uint)TeleportFlags.ViaLogin, ctx, out reason); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1)); @@ -260,16 +262,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + // UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); - + TestScene myScene1 = new SceneHelpers().SetupScene("Neighbour y", UUID.Random(), 1000, 1000); TestScene myScene2 = new SceneHelpers().SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); IConfigSource configSource = new IniConfigSource(); IConfig config = configSource.AddConfig("Startup"); config.Set("serverside_object_permissions", true); - config.Set("EventQueue", true); EntityTransferModule etm = new EntityTransferModule(); @@ -278,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests EventQueueGetModule eqgm2 = new EventQueueGetModule(); SceneHelpers.SetupSceneModules(myScene2, configSource, etm, eqgm2); - + // SceneHelpers.AddScenePresence(myScene1, agent1Id); // ScenePresence childPresence = myScene2.GetScenePresence(agent1); // @@ -287,4 +288,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Assert.That(childPresence.IsChildAgent, Is.True); } } -} \ 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 42d91b9..d650c43 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestScene scene = new SceneHelpers().SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); sp.Flying = true; - sp.PhysicsCollisionUpdate(new CollisionEventUpdate()); + sp.Animator.UpdateMovementAnimations(); Assert.That(sp.Animator.CurrentMovementAnimation, Is.EqualTo("HOVER")); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index e5c847e..90c5197 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X)); - m_scene.Update(10); + m_scene.Update(50); double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move"); @@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y)); Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z)); - m_scene.Update(10); + m_scene.Update(50); distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos); Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs index 2e6dc70..aa26767 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs @@ -73,14 +73,16 @@ namespace OpenSim.Region.Framework.Scenes.Tests SceneHelpers.SetupSceneModules(scene, capsMod); ScenePresence sp = SceneHelpers.AddChildScenePresence(scene, spUuid); - Assert.That(capsMod.GetCapsForUser(spUuid), Is.Not.Null); + //Assert.That(capsMod.GetCapsForUser(spUuid), Is.Not.Null); // TODO: Need to add tests for other ICapabiltiesModule methods. +// scene.IncomingCloseAgent(sp.UUID, false); +// //Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null); scene.CloseAgent(sp.UUID, false); - Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null); +// Assert.That(capsMod.GetCapsForUser(spUuid), Is.Null); // TODO: Need to add tests for other ICapabiltiesModule methods. } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index 7127644..3d51a63 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs @@ -39,6 +39,8 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.World.Permissions; using OpenSim.Tests.Common; +using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; +using System.Threading; namespace OpenSim.Region.Framework.Scenes.Tests { @@ -190,7 +192,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // We need to set up the permisions module on scene B so that our later use of agent limit to deny // QueryAccess won't succeed anyway because administrators are always allowed in and the default // IsAdministrator if no permissions module is present is true. - SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), new PermissionsModule(), etmB); + SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), new DefaultPermissionsModule(), etmB); AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); TestClient tc = new TestClient(acd, sceneA); @@ -229,7 +231,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests ScenePresence spAfterCrossSceneB = sceneB.GetScenePresence(originalSp.UUID); - // sceneB agent should also still be root + // sceneB agent should still be child Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True); // sceneB should ignore unauthorized attempt to upgrade agent to root @@ -244,4 +246,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(spAfterCrossSceneB.IsChildAgent, Is.True); } } -} \ 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 b232a44..e3ebf36 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -166,6 +166,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests [Test] public void TestSitAndStandWithSitTarget() { +/* sit position math as changed, this needs to be fixed later TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -223,6 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero)); Assert.That(part.GetSittingAvatarsCount(), Is.EqualTo(0)); Assert.That(part.GetSittingAvatars(), Is.Null); +*/ } [Test] @@ -246,4 +248,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests Assert.That(m_sp.PhysicsActor, Is.Not.Null); } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 443ec51..86500c7 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -282,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // We need to set up the permisions module on scene B so that our later use of agent limit to deny // QueryAccess won't succeed anyway because administrators are always allowed in and the default // IsAdministrator if no permissions module is present is true. - SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); + SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB }); // Shared scene modules SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); @@ -447,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // We need to set up the permisions module on scene B so that our later use of agent limit to deny // QueryAccess won't succeed anyway because administrators are always allowed in and the default // IsAdministrator if no permissions module is present is true. - SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); + SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new DefaultPermissionsModule(), etmB }); // Shared scene modules SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); @@ -465,7 +465,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests teleportLookAt, (uint)TeleportFlags.ViaLocation); - // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate + // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate // communication with the destination region. But this is a very non-obvious way of doing it - really we // should be forced to expicitly set this up. @@ -627,8 +627,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Both these operations will occur on different threads and will wait for each other. // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1 // test protocol, where we are trying to avoid unpredictable async operations in regression tests. - tc.OnTestClientSendRegionTeleport - += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) + tc.OnTestClientSendRegionTeleport + += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null); sceneA.RequestTeleportLocation( diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs index 045fd3c..4ce6a95 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs @@ -54,8 +54,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests UUID ownerId = TestHelpers.ParseTail(0x1); SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(3, ownerId, "so1", 0x10); - so1.ScriptSetPhysicsStatus(true); m_scene.AddSceneObject(so1); + so1.ScriptSetPhysicsStatus(true); Assert.That(m_scene.SceneGraph.GetTotalObjectsCount(), Is.EqualTo(3)); Assert.That(m_scene.SceneGraph.GetActiveObjectsCount(), Is.EqualTo(3)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs index 584a03c..dbb6a37 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Must still be possible to successfully log in UUID loggingInUserId = TestHelpers.ParseTail(0x2); - UserAccount ua + UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password"); SceneHelpers.AddScenePresence(scene, ua); @@ -107,7 +107,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // Must still be possible to successfully log in UUID loggingInUserId = TestHelpers.ParseTail(0x2); - UserAccount ua + UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password"); SceneHelpers.AddScenePresence(scene, ua); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 517faf1..6c0af8f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests uint sizeX = 512; uint sizeY = 512; - Scene scene + Scene scene = new SceneHelpers().SetupScene("scene", regionUuid, 1000, 1000, sizeX, sizeY, new IniConfigSource()); Assert.AreEqual(sizeX, scene.RegionInfo.RegionSizeX); @@ -83,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Scene scene = new SceneHelpers().SetupScene(); scene.Update(1); - + Assert.That(scene.Frame, Is.EqualTo(1)); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs index eeda84f..c74c83f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SharedRegionModuleTests.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // rmcp.LoadModulesFromAddins = false; //// reg.RegisterInterface(rmcp); // rmcp.Initialise(sim); -// rmcp.PostInitialise(); +// rmcp.PostInitialise(); // TypeExtensionNode node = new TypeExtensionNode(); // node. // rmcp.AddNode(node, configSource.Configs["Modules"], new Dictionary>()); @@ -120,9 +120,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests int expectedEventCount = 6; Assert.AreEqual( - expectedEventCount, - co.Count, - "Expected {0} events but only got {1} ({2})", + expectedEventCount, + co.Count, + "Expected {0} events but only got {1} ({2})", expectedEventCount, co.Count, string.Join(",", co)); Assert.AreEqual("Initialise", co[0]); Assert.AreEqual("PostInitialise", co[1]); @@ -137,7 +137,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { // FIXME: Should really use MethodInfo public List CallOrder = new List(); - + public string Name { get { return "TestSharedRegion"; } } public Type ReplaceableInterface { get { return null; } } @@ -186,13 +186,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void Initialise() {} - public void Initialise(OpenSimBase sim) + public void Initialise(OpenSimBase sim) { m_openSim = sim; } /// - /// Called when the application loading is completed + /// Called when the application loading is completed /// public void PostInitialise() { @@ -228,8 +228,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests } scene.RegionModules.Clear(); - } - + } + public void AddNode(ISharedRegionModule module) { m_sharedInstances.Add(module); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index b01088d..8273e32 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -55,7 +55,7 @@ namespace OpenSim.Region.Framework.Tests { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); @@ -78,7 +78,7 @@ namespace OpenSim.Region.Framework.Tests { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); @@ -95,7 +95,7 @@ namespace OpenSim.Region.Framework.Tests Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f); Vector3 rezVel = new Vector3(2, 2, 2); - scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0); + scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0,false); SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso"); @@ -121,7 +121,7 @@ namespace OpenSim.Region.Framework.Tests { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); @@ -130,18 +130,18 @@ namespace OpenSim.Region.Framework.Tests = TaskInventoryHelpers.AddNotecard( scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); - InventoryFolderBase folder + InventoryFolderBase folder = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; - + // Perform test string message; scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID, out message); - + InventoryItemBase ncUserItem = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); } - + /// /// Test MoveTaskInventoryItem from a part inventory to a user inventory where the item has no parent folder assigned. /// @@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Tests { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); @@ -162,11 +162,11 @@ namespace OpenSim.Region.Framework.Tests TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard( scene.AssetService, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); - + // Perform test string message; scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID, out message); - + InventoryItemBase ncUserItem = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index 8250e6c..58e157c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -38,10 +38,7 @@ using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; -using OpenSim.Region.CoreModules.World.Serialiser; -using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; +using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; @@ -116,7 +113,7 @@ namespace OpenSim.Region.Framework.Tests { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - + Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); @@ -138,5 +135,66 @@ namespace OpenSim.Region.Framework.Tests Assert.That(reretrievedFolders.Count, Is.EqualTo(2)); } + + // Work in Progress test. All Assertions pertaining permissions are commented for now. + [Test] + public void TestGiveInventoryItemFullPerms() + { + TestHelpers.InMethod(); + + List modules = new List(); + IConfigSource config = DefaultConfig(modules); + Scene scene = new SceneHelpers().SetupScene("Inventory Permissions", UUID.Random(), 1000, 1000, config); + SceneHelpers.SetupSceneModules(scene, config, modules.ToArray()); + + UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1001)); + UserAccount user2 = UserAccountHelpers.CreateUserWithInventory(scene, TestHelpers.ParseTail(1002)); + ScenePresence sp1 = SceneHelpers.AddScenePresence(scene, user1.PrincipalID); + ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, user2.PrincipalID); + + InventoryItemBase item1 = UserInventoryHelpers.CreateInventoryItem(scene, "SomeObject", user1.PrincipalID, InventoryType.Object); + // Set All perms in inventory + item1.NextPermissions = (uint)OpenMetaverse.PermissionMask.All; + scene.UpdateInventoryItemAsset(sp1.ControllingClient, UUID.Zero, item1.ID, item1); + //Assert.That((item1.NextPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); + + string message; + + InventoryItemBase retrievedItem1 = scene.GiveInventoryItem(user2.PrincipalID, user1.PrincipalID, item1.ID, out message); + Assert.That(retrievedItem1, Is.Not.Null); + //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); + + retrievedItem1 + = UserInventoryHelpers.GetInventoryItem(scene.InventoryService, user2.PrincipalID, "Objects/SomeObject"); + Assert.That(retrievedItem1, Is.Not.Null); + //Assert.That((retrievedItem1.BasePermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); + //Assert.That((retrievedItem1.CurrentPermissions & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); + + // Rez the object + scene.RezObject(sp2.ControllingClient, retrievedItem1.ID, UUID.Zero, Vector3.Zero, Vector3.Zero, UUID.Zero, 0, false, false, false, UUID.Zero); + SceneObjectGroup sog = scene.GetSceneObjectGroup("SomeObject"); + Assert.That(sog, Is.Not.Null); + + // This is failing for all sorts of reasons. We'll fix it after perms are fixed. + //Console.WriteLine("Item Perms " + retrievedItem1.CurrentPermissions + " Obj Owner Perms " + sog.RootPart.OwnerMask + " Base Perms " + sog.RootPart.BaseMask + "\n"); + //Assert.True((sog.RootPart.OwnerMask & (uint)OpenMetaverse.PermissionMask.All) == (uint)OpenMetaverse.PermissionMask.All); + + } + + public static IConfigSource DefaultConfig(List modules) + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); + + config.AddConfig("Permissions"); + config.Configs["Permissions"].Set("permissionmodules", "DefaultPermissionsModule"); + config.Configs["Permissions"].Set("serverside_object_permissions", true); + config.Configs["Permissions"].Set("propagate_permissions", true); + + modules.Add(new BasicInventoryAccessModule()); + return config; + } + } } \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index 937c414..4ceebc1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests { protected IAssetService m_assetService; protected UuidGatherer m_uuidGatherer; - + [SetUp] public void Init() { @@ -55,9 +55,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestCorruptAsset() { TestHelpers.InMethod(); - + UUID corruptAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); - AssetBase corruptAsset + AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); m_assetService.Store(corruptAsset); @@ -67,7 +67,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // We count the uuid as gathered even if the asset itself is corrupt. Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1)); } - + /// /// Test requests made for non-existent assets while we're gathering /// @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests public void TestMissingAsset() { TestHelpers.InMethod(); - + UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); m_uuidGatherer.AddForInspection(missingAssetUuid); @@ -89,23 +89,23 @@ namespace OpenSim.Region.Framework.Scenes.Tests { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - + UUID ownerId = TestHelpers.ParseTail(0x10); UUID embeddedId = TestHelpers.ParseTail(0x20); UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); UUID ncAssetId = TestHelpers.ParseTail(0x30); - AssetBase ncAsset + AssetBase ncAsset = AssetHelpers.CreateNotecardAsset( ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); m_assetService.Store(ncAsset); - AssetBase embeddedAsset + AssetBase embeddedAsset = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); m_assetService.Store(embeddedAsset); - AssetBase secondLevelEmbeddedAsset + AssetBase secondLevelEmbeddedAsset = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); m_assetService.Store(secondLevelEmbeddedAsset); -- cgit v1.1