Unit test breakage fix.

prebuild-update
Diva Canto 2010-08-20 11:09:02 -07:00
parent 6f83b0ee46
commit f347d25675
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,7 +109,7 @@ 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();

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,6 +230,10 @@ 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);