diff options
author | Justin Clarke Casey | 2009-02-03 20:13:34 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-03 20:13:34 +0000 |
commit | 2009d1aa01ca615dbcd4b69d3cab179741d9ee1f (patch) | |
tree | f5bf449fa6194041fd2a07dbd0de243822e33fb1 /OpenSim | |
parent | * Lock the parts for the old group while we're clearing it as well - not much... (diff) | |
download | opensim-SC-2009d1aa01ca615dbcd4b69d3cab179741d9ee1f.zip opensim-SC-2009d1aa01ca615dbcd4b69d3cab179741d9ee1f.tar.gz opensim-SC-2009d1aa01ca615dbcd4b69d3cab179741d9ee1f.tar.bz2 opensim-SC-2009d1aa01ca615dbcd4b69d3cab179741d9ee1f.tar.xz |
* Fission SceneObjectTests into basic and linking sets
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Tests/SceneObjectBasicTests.cs | 139 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Tests/SceneObjectLinkingTests.cs (renamed from OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs) | 103 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 |
4 files changed, 151 insertions, 99 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs index 30f5675..6e2bf53 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeModule.cs | |||
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Concierge | |||
164 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; | 164 | scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | _log.InfoFormat("[Concierge] initialized for {0}", scene.RegionInfo.RegionName); | 167 | _log.InfoFormat("[Concierge]: initialized for {0}", scene.RegionInfo.RegionName); |
168 | } | 168 | } |
169 | 169 | ||
170 | public override void PostInitialise() | 170 | public override void PostInitialise() |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectBasicTests.cs new file mode 100644 index 0000000..d063eae --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -0,0 +1,139 @@ | |||
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 OpenSim 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 NUnit.Framework; | ||
30 | using NUnit.Framework.SyntaxHelpers; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Region.Communications.Local; | ||
36 | using OpenSim.Region.Environment.Scenes; | ||
37 | using OpenSim.Tests.Common.Mock; | ||
38 | using OpenSim.Tests.Common.Setup; | ||
39 | |||
40 | namespace OpenSim.Region.Environment.Scenes.Tests | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// Basic scene object tests (create, read and delete but not update). | ||
44 | /// </summary> | ||
45 | [TestFixture] | ||
46 | public class SceneObjectTests | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// Test adding an object to a scene. | ||
50 | /// </summary> | ||
51 | [Test] | ||
52 | public void TestAddSceneObject() | ||
53 | { | ||
54 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
55 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
56 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
57 | |||
58 | //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); | ||
59 | // If the parts have the same UUID then we will consider them as one and the same | ||
60 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Test deleting an object from a scene. | ||
65 | /// </summary> | ||
66 | [Test] | ||
67 | public void TestDeleteSceneObject() | ||
68 | { | ||
69 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
70 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
71 | scene.DeleteSceneObject(part.ParentGroup, false); | ||
72 | |||
73 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
74 | Assert.That(retrievedPart, Is.Null); | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
78 | /// Test deleting an object asynchronously | ||
79 | /// </summary> | ||
80 | [Test] | ||
81 | public void TestDeleteSceneObjectAsync() | ||
82 | { | ||
83 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
84 | |||
85 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
86 | |||
87 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
88 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
89 | sogd.Enabled = false; | ||
90 | |||
91 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
92 | |||
93 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | ||
94 | scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
95 | |||
96 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
97 | Assert.That(retrievedPart, Is.Not.Null); | ||
98 | |||
99 | sogd.InventoryDeQueueAndDelete(); | ||
100 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); | ||
101 | Assert.That(retrievedPart2, Is.Null); | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Test deleting an object asynchronously to user inventory. | ||
106 | /// </summary> | ||
107 | [Test] | ||
108 | public void TestDeleteSceneObjectAsyncToUserInventory() | ||
109 | { | ||
110 | //log4net.Config.XmlConfigurator.Configure(); | ||
111 | |||
112 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
113 | string myObjectName = "Fred"; | ||
114 | |||
115 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
116 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); | ||
117 | |||
118 | Assert.That( | ||
119 | scene.CommsManager.UserAdminService.AddUser( | ||
120 | "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | ||
121 | Is.EqualTo(agentId)); | ||
122 | |||
123 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | ||
124 | |||
125 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | ||
126 | Assert.That(userInfo, Is.Not.Null); | ||
127 | Assert.That(userInfo.RootFolder, Is.Not.Null); | ||
128 | |||
129 | SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | ||
130 | |||
131 | // Check that we now have the taken part in our inventory | ||
132 | Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); | ||
133 | |||
134 | // Check that the taken part has actually disappeared | ||
135 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
136 | Assert.That(retrievedPart, Is.Null); | ||
137 | } | ||
138 | } | ||
139 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectLinkingTests.cs index 2164b0d..30b0987 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectLinkingTests.cs | |||
@@ -40,67 +40,11 @@ using OpenSim.Tests.Common.Setup; | |||
40 | namespace OpenSim.Region.Environment.Scenes.Tests | 40 | namespace OpenSim.Region.Environment.Scenes.Tests |
41 | { | 41 | { |
42 | /// <summary> | 42 | /// <summary> |
43 | /// Scene object tests | 43 | /// Linking tests |
44 | /// </summary> | 44 | /// </summary> |
45 | [TestFixture] | 45 | [TestFixture] |
46 | public class SceneObjectTests | 46 | public class SceneObjectLinkingTests |
47 | { | 47 | { |
48 | /// <summary> | ||
49 | /// Test adding an object to a scene. | ||
50 | /// </summary> | ||
51 | [Test] | ||
52 | public void TestAddSceneObject() | ||
53 | { | ||
54 | Scene scene = SceneSetupHelpers.SetupScene(); | ||
55 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
56 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
57 | |||
58 | //System.Console.WriteLine("retrievedPart : {0}", retrievedPart); | ||
59 | // If the parts have the same UUID then we will consider them as one and the same | ||
60 | Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); | ||
61 | } | ||
62 | |||
63 | /// <summary> | ||
64 | /// Test deleting an object from a scene. | ||
65 | /// </summary> | ||
66 | [Test] | ||
67 | public void TestDeleteSceneObject() | ||
68 | { | ||
69 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
70 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
71 | scene.DeleteSceneObject(part.ParentGroup, false); | ||
72 | |||
73 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
74 | Assert.That(retrievedPart, Is.Null); | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
78 | /// Test deleting an object asynchronously | ||
79 | /// </summary> | ||
80 | [Test] | ||
81 | public void TestDeleteSceneObjectAsync() | ||
82 | { | ||
83 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
84 | |||
85 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
86 | |||
87 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
88 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
89 | sogd.Enabled = false; | ||
90 | |||
91 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); | ||
92 | |||
93 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | ||
94 | scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
95 | |||
96 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
97 | Assert.That(retrievedPart, Is.Not.Null); | ||
98 | |||
99 | sogd.InventoryDeQueueAndDelete(); | ||
100 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); | ||
101 | Assert.That(retrievedPart2, Is.Null); | ||
102 | } | ||
103 | |||
104 | [Test] | 48 | [Test] |
105 | public void TestLinkDelink2SceneObjects() | 49 | public void TestLinkDelink2SceneObjects() |
106 | { | 50 | { |
@@ -300,41 +244,6 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
300 | && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) | 244 | && (part4.RotationOffset.Y - compareQuaternion.Y < 0.00003) |
301 | && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) | 245 | && (part4.RotationOffset.Z - compareQuaternion.Z < 0.00003) |
302 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003)); | 246 | && (part4.RotationOffset.W - compareQuaternion.W < 0.00003)); |
303 | } | 247 | } |
304 | |||
305 | /// <summary> | ||
306 | /// Test deleting an object asynchronously to user inventory. | ||
307 | /// </summary> | ||
308 | [Test] | ||
309 | public void TestDeleteSceneObjectAsyncToUserInventory() | ||
310 | { | ||
311 | //log4net.Config.XmlConfigurator.Configure(); | ||
312 | |||
313 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
314 | string myObjectName = "Fred"; | ||
315 | |||
316 | TestScene scene = SceneSetupHelpers.SetupScene(); | ||
317 | SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); | ||
318 | |||
319 | Assert.That( | ||
320 | scene.CommsManager.UserAdminService.AddUser( | ||
321 | "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | ||
322 | Is.EqualTo(agentId)); | ||
323 | |||
324 | IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | ||
325 | |||
326 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | ||
327 | Assert.That(userInfo, Is.Not.Null); | ||
328 | Assert.That(userInfo.RootFolder, Is.Not.Null); | ||
329 | |||
330 | SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | ||
331 | |||
332 | // Check that we now have the taken part in our inventory | ||
333 | Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); | ||
334 | |||
335 | // Check that the taken part has actually disappeared | ||
336 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
337 | Assert.That(retrievedPart, Is.Null); | ||
338 | } | ||
339 | } | 248 | } |
340 | } \ No newline at end of file | 249 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8fb94b0..7564c69 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3172,6 +3172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3172 | childPrim = null; | 3172 | childPrim = null; |
3173 | break; | 3173 | break; |
3174 | } | 3174 | } |
3175 | |||
3175 | if (linknum == ScriptBaseClass.LINK_ROOT) | 3176 | if (linknum == ScriptBaseClass.LINK_ROOT) |
3176 | { | 3177 | { |
3177 | // Restructuring Multiple Prims. | 3178 | // Restructuring Multiple Prims. |
@@ -3182,7 +3183,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3182 | parentPrim.DelinkFromGroup(part.LocalId, true); | 3183 | parentPrim.DelinkFromGroup(part.LocalId, true); |
3183 | } | 3184 | } |
3184 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3185 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
3185 | if (parts.Count > 0) { | 3186 | |
3187 | if (parts.Count > 0) | ||
3188 | { | ||
3186 | SceneObjectPart newRoot = parts[0]; | 3189 | SceneObjectPart newRoot = parts[0]; |
3187 | parts.Remove(newRoot); | 3190 | parts.Remove(newRoot); |
3188 | foreach (SceneObjectPart part in parts) | 3191 | foreach (SceneObjectPart part in parts) |
@@ -3196,6 +3199,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3196 | { | 3199 | { |
3197 | if (childPrim == null) | 3200 | if (childPrim == null) |
3198 | return; | 3201 | return; |
3202 | |||
3199 | parentPrim.DelinkFromGroup(childPrim.LocalId, true); | 3203 | parentPrim.DelinkFromGroup(childPrim.LocalId, true); |
3200 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); | 3204 | parentPrim.TriggerScriptChangedEvent(Changed.LINK); |
3201 | } | 3205 | } |