aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-17 01:27:59 +0100
committerJustin Clark-Casey (justincc)2012-05-17 01:27:59 +0100
commitbdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1 (patch)
treec1f43085c38c7f1be190523d9ab261b6a51495e0 /OpenSim
parentRemove redundant "Teleport failed:" from reason when QueryAccess fails for th... (diff)
downloadopensim-SC_OLD-bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1.zip
opensim-SC_OLD-bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1.tar.gz
opensim-SC_OLD-bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1.tar.bz2
opensim-SC_OLD-bdcf2d1348c6770a42a91ca5b3c7d74d2307b0c1.tar.xz
Add regression TestSameSimulatorSeparatedRegionsQueryAccessFails()
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs76
-rw-r--r--OpenSim/Tests/Common/TestHelpers.cs2
2 files changed, 77 insertions, 1 deletions
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;
37using OpenSim.Region.CoreModules.Framework; 37using OpenSim.Region.CoreModules.Framework;
38using OpenSim.Region.CoreModules.Framework.EntityTransfer; 38using OpenSim.Region.CoreModules.Framework.EntityTransfer;
39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 39using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
40using OpenSim.Region.CoreModules.World.Permissions;
40using OpenSim.Tests.Common; 41using OpenSim.Tests.Common;
41using OpenSim.Tests.Common.Mock; 42using OpenSim.Tests.Common.Mock;
42using System.IO; 43using System.IO;
@@ -161,6 +162,81 @@ namespace OpenSim.Region.Framework.Scenes.Tests
161// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); 162// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
162 } 163 }
163 164
165 /// <summary>
166 /// Test teleport procedures when the target simulator returns false when queried about access.
167 /// </summary>
168 [Test]
169 public void TestSameSimulatorSeparatedRegionsQueryAccessFails()
170 {
171 TestHelpers.InMethod();
172 TestHelpers.EnableLogging();
173
174 UUID userId = TestHelpers.ParseTail(0x1);
175 Vector3 preTeleportPosition = new Vector3(30, 31, 32);
176
177 EntityTransferModule etm = new EntityTransferModule();
178 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
179
180 IConfigSource config = new IniConfigSource();
181 config.AddConfig("Modules");
182 config.Configs["Modules"].Set("EntityTransferModule", etm.Name);
183 config.Configs["Modules"].Set("SimulationServices", lscm.Name);
184
185 config.AddConfig("EntityTransfer");
186
187 // In order to run a single threaded regression test we do not want the entity transfer module waiting
188 // for a callback from the destination scene before removing its avatar data.
189 config.Configs["EntityTransfer"].Set("wait_for_callback", false);
190
191 config.AddConfig("Startup");
192 config.Configs["Startup"].Set("serverside_object_permissions", true);
193
194 SceneHelpers sh = new SceneHelpers();
195 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
196 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
197
198 // We need to set up the permisions module on scene B so that our later use of agent limit to deny
199 // QueryAccess won't succeed anyway because administrators are always allowed in and the default
200 // IsAdministrator if no permissions module is present is true.
201 SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule() });
202
203 // Shared scene modules
204 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, etm, lscm);
205
206 Vector3 teleportPosition = new Vector3(10, 11, 12);
207 Vector3 teleportLookAt = new Vector3(20, 21, 22);
208
209 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
210 sp.AbsolutePosition = preTeleportPosition;
211
212 // Make sceneB return false on query access
213 sceneB.RegionInfo.RegionSettings.AgentLimit = 0;
214
215 sceneA.RequestTeleportLocation(
216 sp.ControllingClient,
217 sceneB.RegionInfo.RegionHandle,
218 teleportPosition,
219 teleportLookAt,
220 (uint)TeleportFlags.ViaLocation);
221
222// ((TestClient)sp.ControllingClient).CompleteTeleportClientSide();
223
224 Assert.That(sceneB.GetScenePresence(userId), Is.Null);
225
226 ScenePresence sceneASp = sceneA.GetScenePresence(userId);
227 Assert.That(sceneASp, Is.Not.Null);
228 Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
229 Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
230
231 // TODO: Add assertions to check correct circuit details in both scenes.
232
233 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
234 // position instead).
235// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
236
237 TestHelpers.DisableLogging();
238 }
239
164 [Test] 240 [Test]
165 public void TestSameSimulatorNeighbouringRegionsTeleport() 241 public void TestSameSimulatorNeighbouringRegionsTeleport()
166 { 242 {
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs
index 6744fca..a241a3c 100644
--- a/OpenSim/Tests/Common/TestHelpers.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Tests.Common
61 private static Stream DisableLoggingConfigStream 61 private static Stream DisableLoggingConfigStream
62 = new MemoryStream( 62 = new MemoryStream(
63 Encoding.UTF8.GetBytes( 63 Encoding.UTF8.GetBytes(
64 // "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"))); 64// "<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/><appender-ref ref=\"A1\"/></root></log4net></configuration>"));
65 //"<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>"))); 65 //"<?xml version=\"1.0\" encoding=\"utf-8\" ?><configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>")));
66// "<configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>")); 66// "<configuration><log4net><root><level value=\"OFF\"/></root></log4net></configuration>"));
67// "<configuration><log4net><root></root></log4net></configuration>"))); 67// "<configuration><log4net><root></root></log4net></configuration>")));