Fix regression tests relating to agent transfer by making simulator use last week's SIMULATOR/0.1 protocol for now.

TeleportWork
Justin Clark-Casey (justincc) 2013-07-26 19:22:30 +01:00
parent a08f01fa83
commit 056a6ee765
5 changed files with 39 additions and 6 deletions

View File

@ -285,7 +285,12 @@ namespace OpenSim.Framework.Servers
public static bool RemoveHttpServer(uint port) public static bool RemoveHttpServer(uint port)
{ {
lock (m_Servers) lock (m_Servers)
{
if (instance != null && instance.Port == port)
instance = null;
return m_Servers.Remove(port); return m_Servers.Remove(port);
}
} }
/// <summary> /// <summary>

View File

@ -38,6 +38,8 @@ using NUnit.Framework;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.Attachments;
using OpenSim.Region.CoreModules.Framework; using OpenSim.Region.CoreModules.Framework;
using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.Framework.EntityTransfer;
@ -802,6 +804,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
BaseHttpServer httpServer = new BaseHttpServer(99999);
MainServer.AddHttpServer(httpServer);
MainServer.Instance = httpServer;
AttachmentsModule attModA = new AttachmentsModule(); AttachmentsModule attModA = new AttachmentsModule();
AttachmentsModule attModB = new AttachmentsModule(); AttachmentsModule attModB = new AttachmentsModule();
EntityTransferModule etmA = new EntityTransferModule(); EntityTransferModule etmA = new EntityTransferModule();
@ -830,6 +836,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
SceneHelpers.SetupSceneModules( SceneHelpers.SetupSceneModules(
sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule());
// FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
lscm.ServiceVersion = "SIMULATION/0.1";
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);

View File

@ -46,9 +46,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Version of this service /// Version of this service.
/// </summary> /// </summary>
private const string m_Version = "SIMULATION/0.2"; /// <remarks>
/// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2"
/// </remarks>
public string ServiceVersion { get; set; }
/// <summary> /// <summary>
/// Map region ID to scene. /// Map region ID to scene.
@ -64,6 +67,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
public void Initialise(IConfigSource config) public void Initialise(IConfigSource config)
{ {
ServiceVersion = "SIMULATION/0.2";
IConfig moduleConfig = config.Configs["Modules"]; IConfig moduleConfig = config.Configs["Modules"];
if (moduleConfig != null) if (moduleConfig != null)
{ {
@ -253,7 +258,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason)
{ {
reason = "Communications failure"; reason = "Communications failure";
version = m_Version; version = ServiceVersion;
if (destination == null) if (destination == null)
return false; return false;
@ -359,4 +364,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
#endregion #endregion
} }
} }

View File

@ -136,6 +136,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneHelpers.SetupSceneModules(sceneB, config, etmB); SceneHelpers.SetupSceneModules(sceneB, config, etmB);
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
// FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
lscm.ServiceVersion = "SIMULATION/0.1";
Vector3 teleportPosition = new Vector3(10, 11, 12); Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22); Vector3 teleportLookAt = new Vector3(20, 21, 22);
@ -454,6 +457,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
// FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour
lscm.ServiceVersion = "SIMULATION/0.1";
Vector3 teleportPosition = new Vector3(10, 11, 12); Vector3 teleportPosition = new Vector3(10, 11, 12);
Vector3 teleportLookAt = new Vector3(20, 21, 22); Vector3 teleportLookAt = new Vector3(20, 21, 22);

View File

@ -27,6 +27,7 @@
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Framework.Servers;
namespace OpenSim.Tests.Common namespace OpenSim.Tests.Common
{ {
@ -40,7 +41,14 @@ namespace OpenSim.Tests.Common
// Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests
// to have logging on if it failed with an exception. // to have logging on if it failed with an exception.
TestHelpers.DisableLogging(); TestHelpers.DisableLogging();
// This is an unfortunate bit of clean up we have to do because MainServer manages things through static
// variables and the VM is not restarted between tests.
if (MainServer.Instance != null)
{
MainServer.RemoveHttpServer(MainServer.Instance.Port);
// MainServer.Instance = null;
}
} }
} }
} }