Create regression test TestSendAgentGroupDataUpdate() for groups agent data sending

master-beforevarregion
Justin Clark-Casey (justincc) 2013-12-18 23:35:38 +00:00
parent 51da52f904
commit a5ca15c428
4 changed files with 71 additions and 8 deletions

View File

@ -295,9 +295,9 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
// Register an event queue for the client // Register an event queue for the client
//m_log.DebugFormat( m_log.DebugFormat(
// "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}", "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
// agentID, caps, m_scene.RegionInfo.RegionName); agentID, caps, m_scene.RegionInfo.RegionName);
// Let's instantiate a Queue for this agent right now // Let's instantiate a Queue for this agent right now
TryGetQueue(agentID); TryGetQueue(agentID);

View File

@ -26,13 +26,23 @@
*/ */
using System; using System;
using System.Collections;
using System.Net;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using NUnit.Framework; using NUnit.Framework;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Messages.Linden;
using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData;
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.ClientStack.Linden;
using OpenSim.Region.CoreModules.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
@ -44,11 +54,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
[TestFixture] [TestFixture]
public class GroupsModuleTests : OpenSimTestCase public class GroupsModuleTests : OpenSimTestCase
{ {
[SetUp]
public override void SetUp()
{
base.SetUp();
uint port = 9999;
uint sslPort = 9998;
// 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.
MainServer.RemoveHttpServer(port);
BaseHttpServer server = new BaseHttpServer(port, false, sslPort, "");
MainServer.AddHttpServer(server);
MainServer.Instance = server;
}
[Test] [Test]
public void TestBasic() public void TestSendAgentGroupDataUpdate()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // TestHelpers.EnableLogging();
TestScene scene = new SceneHelpers().SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
IConfigSource configSource = new IniConfigSource(); IConfigSource configSource = new IniConfigSource();
@ -56,8 +83,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
config.Set("Enabled", true); config.Set("Enabled", true);
config.Set("Module", "GroupsModule"); config.Set("Module", "GroupsModule");
config.Set("DebugEnabled", true); config.Set("DebugEnabled", true);
GroupsModule gm = new GroupsModule();
EventQueueGetModule eqgm = new EventQueueGetModule();
// We need a capabilities module active so that adding the scene presence creates an event queue in the
// EventQueueGetModule
SceneHelpers.SetupSceneModules( SceneHelpers.SetupSceneModules(
scene, configSource, new object[] { new MockGroupsServicesConnector() }); scene, configSource, gm, new MockGroupsServicesConnector(), new CapabilitiesModule(), eqgm);
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseStem("1"));
gm.SendAgentGroupDataUpdate(sp.ControllingClient);
Hashtable eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID);
Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK));
// Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]);
OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml((string)eventsResponse["str_response_string"]);
OSDArray eventsOsd = (OSDArray)rawOsd["events"];
bool foundUpdate = false;
foreach (OSD osd in eventsOsd)
{
OSDMap eventOsd = (OSDMap)osd;
if (eventOsd["message"] == "AgentGroupDataUpdate")
foundUpdate = true;
}
Assert.That(foundUpdate, Is.True, "Did not find AgentGroupDataUpdate in response");
// TODO: More checking of more actual event data.
} }
} }
} }

View File

@ -38,6 +38,7 @@ using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.ClientStack.Linden;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
@ -164,7 +165,7 @@ namespace OpenSim.Tests.Common
throw new System.NotImplementedException (); throw new System.NotImplementedException ();
} }
public OSD BuildEvent (string eventName, OSD eventBody) public OSD BuildEvent(string eventName, OSD eventBody)
{ {
Console.WriteLine("TWO"); Console.WriteLine("TWO");
throw new System.NotImplementedException (); throw new System.NotImplementedException ();

View File

@ -2839,8 +2839,9 @@
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.OptionalModules"/> <Reference name="OpenSim.Region.OptionalModules"/>
<Reference name="OpenSim.Region.Physics.Manager"/> <Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Region.ScriptEngine.Shared"/> <Reference name="OpenSim.Region.ScriptEngine.Shared"/>
@ -3200,6 +3201,7 @@
<Reference name="System.Drawing"/> <Reference name="System.Drawing"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/> <Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/> <Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenSim.Data"/> <Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Serialization"/> <Reference name="OpenSim.Framework.Serialization"/>
@ -3208,6 +3210,7 @@
<Reference name="OpenSim.Framework.Monitoring"/> <Reference name="OpenSim.Framework.Monitoring"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/> <Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Region.ClientStack.LindenCaps"/>
<Reference name="OpenSim.Region.Framework"/> <Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/> <Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.OptionalModules"/> <Reference name="OpenSim.Region.OptionalModules"/>