From bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 17 May 2012 01:27:59 +0100
Subject: Add regression TestSameSimulatorSeparatedRegionsQueryAccessFails()
---
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 76 ++++++++++++++++++++++
1 file changed, 76 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index ea4fb66..7c76bed 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.Framework;
using OpenSim.Region.CoreModules.Framework.EntityTransfer;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
+using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using System.IO;
@@ -161,6 +162,81 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
}
+ ///
+ /// Test teleport procedures when the target simulator returns false when queried about access.
+ ///
+ [Test]
+ public void TestSameSimulatorSeparatedRegionsQueryAccessFails()
+ {
+ TestHelpers.InMethod();
+ TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+ Vector3 preTeleportPosition = new Vector3(30, 31, 32);
+
+ EntityTransferModule etm = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
+ config.Configs["Modules"].Set("SimulationServices", lscm.Name);
+
+ config.AddConfig("EntityTransfer");
+
+ // In order to run a single threaded regression test we do not want the entity transfer module waiting
+ // for a callback from the destination scene before removing its avatar data.
+ config.Configs["EntityTransfer"].Set("wait_for_callback", false);
+
+ config.AddConfig("Startup");
+ config.Configs["Startup"].Set("serverside_object_permissions", true);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
+
+ // 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() });
+
+ // Shared scene modules
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
+
+ Vector3 teleportPosition = new Vector3(10, 11, 12);
+ Vector3 teleportLookAt = new Vector3(20, 21, 22);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
+ sp.AbsolutePosition = preTeleportPosition;
+
+ // Make sceneB return false on query access
+ sceneB.RegionInfo.RegionSettings.AgentLimit = 0;
+
+ sceneA.RequestTeleportLocation(
+ sp.ControllingClient,
+ sceneB.RegionInfo.RegionHandle,
+ teleportPosition,
+ teleportLookAt,
+ (uint)TeleportFlags.ViaLocation);
+
+// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
+
+ Assert.That(sceneB.GetScenePresence(userId), Is.Null);
+
+ ScenePresence sceneASp = sceneA.GetScenePresence(userId);
+ Assert.That(sceneASp, Is.Not.Null);
+ Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
+ Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
+
+ // TODO: Add assertions to check correct circuit details in both scenes.
+
+ // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
+ // position instead).
+// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
+
+ TestHelpers.DisableLogging();
+ }
+
[Test]
public void TestSameSimulatorNeighbouringRegionsTeleport()
{
--
cgit v1.1
From f0c9cb8dc0eeccf2c686ff8ceacc7e1acceb543d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 17 May 2012 01:34:04 +0100
Subject: Comment out TestSameSimulatorSeparatedRegionsQueryAccessFails()
regression test logging accidentally left in
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 7c76bed..a351271 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestSameSimulatorSeparatedRegionsQueryAccessFails()
{
TestHelpers.InMethod();
- TestHelpers.EnableLogging();
+// TestHelpers.EnableLogging();
UUID userId = TestHelpers.ParseTail(0x1);
Vector3 preTeleportPosition = new Vector3(30, 31, 32);
@@ -234,7 +234,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// position instead).
// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
- TestHelpers.DisableLogging();
+// TestHelpers.DisableLogging();
}
[Test]
--
cgit v1.1
From d19fb6fb0c7983126e327b80686c25c9d7f0fcfc Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 17 May 2012 03:12:31 +0100
Subject: Add regression TestSameSimulatorSeparatedRegionsCreateAgentFails()
---
.../Scenes/Tests/ScenePresenceTeleportTests.cs | 67 ++++++++++++++++++++++
1 file changed, 67 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index a351271..7839394 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -237,6 +237,73 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// TestHelpers.DisableLogging();
}
+ ///
+ /// Test teleport procedures when the target simulator returns false when queried about access.
+ ///
+ [Test]
+ public void TestSameSimulatorSeparatedRegionsCreateAgentFails()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID userId = TestHelpers.ParseTail(0x1);
+ Vector3 preTeleportPosition = new Vector3(30, 31, 32);
+
+ EntityTransferModule etm = new EntityTransferModule();
+ LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
+
+ IConfigSource config = new IniConfigSource();
+ config.AddConfig("Modules");
+ config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
+ config.Configs["Modules"].Set("SimulationServices", lscm.Name);
+
+ config.AddConfig("EntityTransfer");
+
+ // In order to run a single threaded regression test we do not want the entity transfer module waiting
+ // for a callback from the destination scene before removing its avatar data.
+ config.Configs["EntityTransfer"].Set("wait_for_callback", false);
+
+ SceneHelpers sh = new SceneHelpers();
+ TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
+ TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
+
+ // Shared scene modules
+ SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
+
+ Vector3 teleportPosition = new Vector3(10, 11, 12);
+ Vector3 teleportLookAt = new Vector3(20, 21, 22);
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
+ sp.AbsolutePosition = preTeleportPosition;
+
+ // Make sceneB refuse CreateAgent
+ sceneB.LoginsDisabled = true;
+
+ sceneA.RequestTeleportLocation(
+ sp.ControllingClient,
+ sceneB.RegionInfo.RegionHandle,
+ teleportPosition,
+ teleportLookAt,
+ (uint)TeleportFlags.ViaLocation);
+
+// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
+
+ Assert.That(sceneB.GetScenePresence(userId), Is.Null);
+
+ ScenePresence sceneASp = sceneA.GetScenePresence(userId);
+ Assert.That(sceneASp, Is.Not.Null);
+ Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
+ Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
+
+ // TODO: Add assertions to check correct circuit details in both scenes.
+
+ // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
+ // position instead).
+// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
+
+// TestHelpers.DisableLogging();
+ }
+
[Test]
public void TestSameSimulatorNeighbouringRegionsTeleport()
{
--
cgit v1.1
From c45b5a3d1cffe506b8f3d3002e186942a0d6b1b4 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 17 May 2012 03:27:05 +0100
Subject: minor: improve method doc for
TestSameSimulatorSeparatedRegionsCreateAgentFails()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 7839394..41bff7f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -238,7 +238,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
///
- /// Test teleport procedures when the target simulator returns false when queried about access.
+ /// Test teleport procedures when the target simulator create agent step is refused.
///
[Test]
public void TestSameSimulatorSeparatedRegionsCreateAgentFails()
--
cgit v1.1
From 295bb3227d0c7d108d73ef7be4fd1dd59f7afc21 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 17 May 2012 00:47:19 -0400
Subject: Force the default Telehub router if no matches are found in the
config.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 57 ++++++++++++------------
1 file changed, 28 insertions(+), 29 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bdcef71..0d5c218 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3939,35 +3939,6 @@ namespace OpenSim.Region.Framework.Scenes
switch (m_scene.SpawnPointRouting)
{
- case "closest":
-
- float distance = 9999;
- int closest = -1;
-
- for (int i = 0; i < spawnPoints.Length; i++)
- {
- Vector3 spawnPosition = spawnPoints[i].GetLocation(
- telehub.AbsolutePosition,
- telehub.GroupRotation
- );
- Vector3 offset = spawnPosition - pos;
- float d = Vector3.Mag(offset);
- if (d >= distance)
- continue;
- ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
- if (land == null)
- continue;
- if (land.IsEitherBannedOrRestricted(UUID))
- continue;
- distance = d;
- closest = i;
- }
- if (closest == -1)
- return;
-
- pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
- return;
-
case "random":
do
@@ -4019,7 +3990,35 @@ namespace OpenSim.Region.Framework.Scenes
return;
default:
+ case "closest":
+
+ float distance = 9999;
+ int closest = -1;
+
+ for (int i = 0; i < spawnPoints.Length; i++)
+ {
+ Vector3 spawnPosition = spawnPoints[i].GetLocation(
+ telehub.AbsolutePosition,
+ telehub.GroupRotation
+ );
+ Vector3 offset = spawnPosition - pos;
+ float d = Vector3.Mag(offset);
+ if (d >= distance)
+ continue;
+ ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y);
+ if (land == null)
+ continue;
+ if (land.IsEitherBannedOrRestricted(UUID))
+ continue;
+ distance = d;
+ closest = i;
+ }
+ if (closest == -1)
+ return;
+
+ pos = spawnPoints[closest].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
return;
+
}
}
}
--
cgit v1.1