aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs118
1 files changed, 118 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
new file mode 100644
index 0000000..584a03c
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
@@ -0,0 +1,118 @@
1/*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that the following conditions are met:
4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above copyright
7 * notice, this list of conditions and the following disclaimer in the
8 * documentation and/or other materials provided with the distribution.
9 * * Neither the name of the OpenSimulator Project nor the
10 * names of its contributors may be used to endorse or promote products
11 * derived from this software without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25using System;
26using Nini.Config;
27using NUnit.Framework;
28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Region.CoreModules.World.Estate;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Services.Interfaces;
34using OpenSim.Tests.Common;
35
36namespace OpenSim.Region.Framework.Scenes.Tests
37{
38 /// <summary>
39 /// Scene telehub tests
40 /// </summary>
41 /// <remarks>
42 /// TODO: Tests which run through normal functionality. Currently, the only test is one that checks behaviour
43 /// in the case of an error condition
44 /// </remarks>
45 [TestFixture]
46 public class SceneTelehubTests : OpenSimTestCase
47 {
48 /// <summary>
49 /// Test for desired behaviour when a telehub has no spawn points
50 /// </summary>
51 [Test]
52 public void TestNoTelehubSpawnPoints()
53 {
54 TestHelpers.InMethod();
55// TestHelpers.EnableLogging();
56
57 EstateManagementModule emm = new EstateManagementModule();
58
59 SceneHelpers sh = new SceneHelpers();
60 Scene scene = sh.SetupScene();
61 SceneHelpers.SetupSceneModules(scene, emm);
62
63 UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
64
65 SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
66
67 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
68 scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
69
70 // Must still be possible to successfully log in
71 UUID loggingInUserId = TestHelpers.ParseTail(0x2);
72
73 UserAccount ua
74 = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
75
76 SceneHelpers.AddScenePresence(scene, ua);
77
78 Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
79 }
80
81 /// <summary>
82 /// Test for desired behaviour when the scene object nominated as a telehub object does not exist.
83 /// </summary>
84 [Test]
85 public void TestNoTelehubSceneObject()
86 {
87 TestHelpers.InMethod();
88// TestHelpers.EnableLogging();
89
90 EstateManagementModule emm = new EstateManagementModule();
91
92 SceneHelpers sh = new SceneHelpers();
93 Scene scene = sh.SetupScene();
94 SceneHelpers.SetupSceneModules(scene, emm);
95
96 UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
97
98 SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
99 SceneObjectGroup spawnPointSo = SceneHelpers.AddSceneObject(scene, "spawnpointObject", telehubSceneObjectOwner);
100
101 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
102 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "spawnpoint add", spawnPointSo.LocalId);
103 scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
104
105 scene.DeleteSceneObject(telehubSo, false);
106
107 // Must still be possible to successfully log in
108 UUID loggingInUserId = TestHelpers.ParseTail(0x2);
109
110 UserAccount ua
111 = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
112
113 SceneHelpers.AddScenePresence(scene, ua);
114
115 Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
116 }
117 }
118} \ No newline at end of file