diff options
author | justincc | 2010-12-15 00:35:36 +0000 |
---|---|---|
committer | justincc | 2010-12-15 00:35:36 +0000 |
commit | b643661938881af6fc782d39e52040ed6d16f03f (patch) | |
tree | 162e0667718b2f68e5f4e90cd10f30e6fa374cbb /OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |
parent | replace ode.dll with one built without asserts turned on (diff) | |
parent | fix mistake in last change of local.include (diff) | |
download | opensim-SC_OLD-b643661938881af6fc782d39e52040ed6d16f03f.zip opensim-SC_OLD-b643661938881af6fc782d39e52040ed6d16f03f.tar.gz opensim-SC_OLD-b643661938881af6fc782d39e52040ed6d16f03f.tar.bz2 opensim-SC_OLD-b643661938881af6fc782d39e52040ed6d16f03f.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs new file mode 100644 index 0000000..39116b6 --- /dev/null +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs | |||
@@ -0,0 +1,131 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using Nini.Config; | ||
32 | using NUnit.Framework; | ||
33 | using NUnit.Framework.SyntaxHelpers; | ||
34 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Communications; | ||
37 | using OpenSim.Region.CoreModules.World.Permissions; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Tests.Common; | ||
40 | using OpenSim.Tests.Common.Mock; | ||
41 | using OpenSim.Tests.Common.Setup; | ||
42 | |||
43 | namespace OpenSim.Region.Framework.Scenes.Tests | ||
44 | { | ||
45 | /// <summary> | ||
46 | /// Tests derez of scene objects by users. | ||
47 | /// </summary> | ||
48 | /// <remarks> | ||
49 | /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. | ||
50 | /// TODO: These tests are very incomplete - they only test for a few conditions. | ||
51 | /// </remarks> | ||
52 | [TestFixture] | ||
53 | public class SceneObjectDeRezTests | ||
54 | { | ||
55 | /// <summary> | ||
56 | /// Test deleting an object from a scene. | ||
57 | /// </summary> | ||
58 | [Test] | ||
59 | public void TestDeRezSceneObject() | ||
60 | { | ||
61 | TestHelper.InMethod(); | ||
62 | // log4net.Config.XmlConfigurator.Configure(); | ||
63 | |||
64 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | ||
65 | |||
66 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
67 | IConfigSource configSource = new IniConfigSource(); | ||
68 | IConfig config = configSource.AddConfig("Startup"); | ||
69 | config.Set("serverside_object_permissions", true); | ||
70 | SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); | ||
71 | TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); | ||
72 | |||
73 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
74 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
75 | sogd.Enabled = false; | ||
76 | |||
77 | SceneObjectPart part | ||
78 | = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | ||
79 | part.Name = "obj1"; | ||
80 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); | ||
81 | List<uint> localIds = new List<uint>(); | ||
82 | localIds.Add(part.LocalId); | ||
83 | |||
84 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
85 | sogd.InventoryDeQueueAndDelete(); | ||
86 | |||
87 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
88 | Assert.That(retrievedPart, Is.Null); | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Test deleting an object from a scene where the deleter is not the owner | ||
93 | /// </summary> | ||
94 | /// | ||
95 | /// This test assumes that the deleter is not a god. | ||
96 | [Test] | ||
97 | public void TestDeRezSceneObjectNotOwner() | ||
98 | { | ||
99 | TestHelper.InMethod(); | ||
100 | // log4net.Config.XmlConfigurator.Configure(); | ||
101 | |||
102 | UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); | ||
103 | UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); | ||
104 | |||
105 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
106 | IConfigSource configSource = new IniConfigSource(); | ||
107 | IConfig config = configSource.AddConfig("Startup"); | ||
108 | config.Set("serverside_object_permissions", true); | ||
109 | SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() }); | ||
110 | TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId); | ||
111 | |||
112 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
113 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
114 | sogd.Enabled = false; | ||
115 | |||
116 | SceneObjectPart part | ||
117 | = new SceneObjectPart(objectOwnerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); | ||
118 | part.Name = "obj1"; | ||
119 | scene.AddNewSceneObject(new SceneObjectGroup(part), false); | ||
120 | List<uint> localIds = new List<uint>(); | ||
121 | localIds.Add(part.LocalId); | ||
122 | |||
123 | scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
124 | sogd.InventoryDeQueueAndDelete(); | ||
125 | |||
126 | // Object should still be in the scene. | ||
127 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
128 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); | ||
129 | } | ||
130 | } | ||
131 | } \ No newline at end of file | ||