OpenSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
SceneTelehubTests.cs
Go to the documentation of this file.
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 
25 using System;
26 using Nini.Config;
27 using NUnit.Framework;
28 using OpenMetaverse;
29 using OpenSim.Framework;
30 using OpenSim.Region.CoreModules.World.Estate;
31 using OpenSim.Region.Framework.Scenes;
32 using OpenSim.Region.Framework.Interfaces;
33 using OpenSim.Services.Interfaces;
34 using OpenSim.Tests.Common;
35 
36 namespace OpenSim.Region.Framework.Scenes.Tests
37 {
45  [TestFixture]
47  {
51  [Test]
53  {
54  TestHelpers.InMethod();
55 // TestHelpers.EnableLogging();
56 
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 
84  [Test]
86  {
87  TestHelpers.InMethod();
88 // TestHelpers.EnableLogging();
89 
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 }
void TestNoTelehubSpawnPoints()
Test for desired behaviour when a telehub has no spawn points
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
void TestNoTelehubSceneObject()
Test for desired behaviour when the scene object nominated as a telehub object does not exist...
Helpers for setting up scenes.
Definition: SceneHelpers.cs:60