Unit test breakage fix.

0.7.0.2-release
Diva Canto 2010-08-20 11:09:02 -07:00
parent b85db02f97
commit c9b685dc15
6 changed files with 65 additions and 20 deletions

View File

@ -142,7 +142,7 @@ namespace OpenSim.Framework.Capabilities
m_httpListenPort = httpPort; m_httpListenPort = httpPort;
if (httpServer.UseSSL) if (httpServer != null && httpServer.UseSSL)
{ {
m_httpListenPort = httpServer.SSLPort; m_httpListenPort = httpServer.SSLPort;
httpListen = httpServer.SSLCommonName; httpListen = httpServer.SSLCommonName;
@ -151,7 +151,7 @@ namespace OpenSim.Framework.Capabilities
m_agentID = agent; m_agentID = agent;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, httpServer.UseSSL); m_capsHandlers = new CapsHandlers(httpServer, httpListen, httpPort, (httpServer == null) ? false : httpServer.UseSSL);
m_regionName = regionName; m_regionName = regionName;
} }

View File

@ -74,7 +74,7 @@ namespace OpenSim.Framework.Capabilities
m_httpListenerHostName = httpListenerHostname; m_httpListenerHostName = httpListenerHostname;
m_httpListenerPort = httpListenerPort; m_httpListenerPort = httpListenerPort;
m_useSSL = https; m_useSSL = https;
if (m_useSSL) if (httpListener != null && m_useSSL)
{ {
m_httpListenerHostName = httpListener.SSLCommonName; m_httpListenerHostName = httpListener.SSLCommonName;
m_httpListenerPort = httpListener.SSLPort; m_httpListenerPort = httpListener.SSLPort;

View File

@ -109,9 +109,9 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
Caps caps Caps caps
= new Caps(m_scene, = new Caps(m_scene,
m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName, m_scene.AssetService, MainServer.Instance, m_scene.RegionInfo.ExternalHostName,
MainServer.Instance.Port, (MainServer.Instance == null) ? 0: MainServer.Instance.Port,
capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName);
caps.RegisterHandlers(); caps.RegisterHandlers();
m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps); m_scene.EventManager.TriggerOnRegisterCaps(agentId, caps);
@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities
caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset; caps.TaskScriptUpdatedCall = m_scene.CapsUpdateTaskInventoryScriptAsset;
caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS; caps.CAPSFetchInventoryDescendents = m_scene.HandleFetchInventoryDescendentsCAPS;
caps.GetClient = m_scene.SceneContents.GetControllingClient; caps.GetClient = m_scene.SceneContents.GetControllingClient;
m_capsHandlers[agentId] = caps; m_capsHandlers[agentId] = caps;
} }

View File

@ -131,11 +131,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
{ {
TestHelper.InMethod(); TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene scene = SceneSetupHelpers.SetupScene(); TestScene scene = SceneSetupHelpers.SetupScene();
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test. // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false; sogd.Enabled = false;
@ -148,7 +148,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Not.Null); Assert.That(retrievedPart, Is.Not.Null);
sogd.InventoryDeQueueAndDelete(); sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);

View File

@ -104,8 +104,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.AgentID = agent1; agent.AgentID = agent1;
agent.firstname = firstName; agent.firstname = firstName;
agent.lastname = "testlastname"; agent.lastname = "testlastname";
agent.SessionID = UUID.Zero; agent.SessionID = UUID.Random();
agent.SecureSessionID = UUID.Zero; agent.SecureSessionID = UUID.Random();
agent.circuitcode = 123; agent.circuitcode = 123;
agent.BaseFolder = UUID.Zero; agent.BaseFolder = UUID.Zero;
agent.InventoryFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero;
@ -114,6 +114,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
agent.child = true; agent.child = true;
if (scene.PresenceService == null)
Console.WriteLine("Presence Service is null");
scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
string reason; string reason;
scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason); scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
testclient = new TestClient(agent, scene); testclient = new TestClient(agent, scene);

View File

@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
@ -63,6 +64,7 @@ namespace OpenSim.Tests.Common.Setup
private static ISharedRegionModule m_inventoryService = null; private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null; private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null; private static ISharedRegionModule m_userAccountService = null;
private static ISharedRegionModule m_presenceService = null;
/// <summary> /// <summary>
/// Set up a test scene /// Set up a test scene
@ -180,7 +182,7 @@ namespace OpenSim.Tests.Common.Setup
else else
StartAssetService(testScene, false); StartAssetService(testScene, false);
// For now, always started a 'real' authenication service // For now, always started a 'real' authentication service
StartAuthenticationService(testScene, true); StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory")) if (realServices.Contains("inventory"))
@ -188,10 +190,9 @@ namespace OpenSim.Tests.Common.Setup
else else
StartInventoryService(testScene, false); StartInventoryService(testScene, false);
if (realServices.Contains("grid")) StartGridService(testScene, true);
StartGridService(testScene, true);
StartUserAccountService(testScene); StartUserAccountService(testScene);
StartPresenceService(testScene);
} }
// If not, make sure the shared module gets references to this new scene // If not, make sure the shared module gets references to this new scene
else else
@ -202,11 +203,15 @@ namespace OpenSim.Tests.Common.Setup
m_inventoryService.RegionLoaded(testScene); m_inventoryService.RegionLoaded(testScene);
m_userAccountService.AddRegion(testScene); m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene); m_userAccountService.RegionLoaded(testScene);
m_presenceService.AddRegion(testScene);
m_presenceService.RegionLoaded(testScene);
} }
m_inventoryService.PostInitialise(); m_inventoryService.PostInitialise();
m_assetService.PostInitialise(); m_assetService.PostInitialise();
m_userAccountService.PostInitialise(); m_userAccountService.PostInitialise();
m_presenceService.PostInitialise();
testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
testScene.SetModuleInterfaces(); testScene.SetModuleInterfaces();
@ -225,7 +230,11 @@ namespace OpenSim.Tests.Common.Setup
m_inventoryService = null; m_inventoryService = null;
m_gridService = null; m_gridService = null;
m_userAccountService = null; m_userAccountService = null;
m_presenceService = null;
testScene.RegionInfo.EstateSettings = new EstateSettings();
testScene.LoginsDisabled = false;
return testScene; return testScene;
} }
@ -336,6 +345,32 @@ namespace OpenSim.Tests.Common.Setup
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
} }
/// <summary>
/// Start a presence service
/// </summary>
/// <param name="testScene"></param>
private static void StartPresenceService(Scene testScene)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("PresenceService");
config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
config.Configs["PresenceService"].Set(
"LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
if (m_presenceService == null)
{
ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
presenceService.Initialise(config);
m_presenceService = presenceService;
}
m_presenceService.AddRegion(testScene);
m_presenceService.RegionLoaded(testScene);
testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
}
/// <summary> /// <summary>
/// Setup modules for a scene using their default settings. /// Setup modules for a scene using their default settings.
/// </summary> /// </summary>
@ -446,9 +481,14 @@ namespace OpenSim.Tests.Common.Setup
{ {
string reason; string reason;
// We emulate the proper login sequence here by doing things in three stages // We emulate the proper login sequence here by doing things in four stages
// Stage 0: log the presence
scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
// Stage 1: simulate login by telling the scene to expect a new user connection // Stage 1: simulate login by telling the scene to expect a new user connection
scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason); if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
Console.WriteLine("NewUserConnection failed: " + reason);
// Stage 2: add the new client as a child agent to the scene // Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene); TestClient client = new TestClient(agentData, scene);
@ -459,7 +499,7 @@ namespace OpenSim.Tests.Common.Setup
//scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
ScenePresence scp = scene.GetScenePresence(agentData.AgentID); ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
scp.MakeRootAgent(new Vector3(90,90,90), true); scp.MakeRootAgent(new Vector3(90, 90, 90), true);
return client; return client;
} }