diff options
author | Justin Clark-Casey (justincc) | 2013-12-18 23:35:38 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-12-18 23:35:38 +0000 |
commit | a5ca15c42893681a777d091c737d5c7615af4f48 (patch) | |
tree | 90b6d2e2ad732a152f3cebcb33a293d4e7686d02 /OpenSim/Region/OptionalModules/Avatar | |
parent | Extend TestLlGetNotecardLine() regression test to contain chars that are two ... (diff) | |
download | opensim-SC_OLD-a5ca15c42893681a777d091c737d5c7615af4f48.zip opensim-SC_OLD-a5ca15c42893681a777d091c737d5c7615af4f48.tar.gz opensim-SC_OLD-a5ca15c42893681a777d091c737d5c7615af4f48.tar.bz2 opensim-SC_OLD-a5ca15c42893681a777d091c737d5c7615af4f48.tar.xz |
Create regression test TestSendAgentGroupDataUpdate() for groups agent data sending
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar')
-rw-r--r-- | OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index c1bdacb..26d2597 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs | |||
@@ -26,13 +26,23 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
30 | using System.Net; | ||
29 | using System.Reflection; | 31 | using System.Reflection; |
30 | using Nini.Config; | 32 | using Nini.Config; |
31 | using NUnit.Framework; | 33 | using NUnit.Framework; |
32 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenMetaverse.Messages.Linden; | ||
36 | using OpenMetaverse.Packets; | ||
37 | using OpenMetaverse.StructuredData; | ||
33 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
40 | using OpenSim.Framework.Servers; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | ||
42 | using OpenSim.Region.ClientStack.Linden; | ||
43 | using OpenSim.Region.CoreModules.Framework; | ||
35 | using OpenSim.Region.Framework.Scenes; | 44 | using OpenSim.Region.Framework.Scenes; |
45 | using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; | ||
36 | using OpenSim.Tests.Common; | 46 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 47 | using OpenSim.Tests.Common.Mock; |
38 | 48 | ||
@@ -44,11 +54,28 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
44 | [TestFixture] | 54 | [TestFixture] |
45 | public class GroupsModuleTests : OpenSimTestCase | 55 | public class GroupsModuleTests : OpenSimTestCase |
46 | { | 56 | { |
57 | [SetUp] | ||
58 | public override void SetUp() | ||
59 | { | ||
60 | base.SetUp(); | ||
61 | |||
62 | uint port = 9999; | ||
63 | uint sslPort = 9998; | ||
64 | |||
65 | // This is an unfortunate bit of clean up we have to do because MainServer manages things through static | ||
66 | // variables and the VM is not restarted between tests. | ||
67 | MainServer.RemoveHttpServer(port); | ||
68 | |||
69 | BaseHttpServer server = new BaseHttpServer(port, false, sslPort, ""); | ||
70 | MainServer.AddHttpServer(server); | ||
71 | MainServer.Instance = server; | ||
72 | } | ||
73 | |||
47 | [Test] | 74 | [Test] |
48 | public void TestBasic() | 75 | public void TestSendAgentGroupDataUpdate() |
49 | { | 76 | { |
50 | TestHelpers.InMethod(); | 77 | TestHelpers.InMethod(); |
51 | // log4net.Config.XmlConfigurator.Configure(); | 78 | // TestHelpers.EnableLogging(); |
52 | 79 | ||
53 | TestScene scene = new SceneHelpers().SetupScene(); | 80 | TestScene scene = new SceneHelpers().SetupScene(); |
54 | IConfigSource configSource = new IniConfigSource(); | 81 | IConfigSource configSource = new IniConfigSource(); |
@@ -56,8 +83,40 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests | |||
56 | config.Set("Enabled", true); | 83 | config.Set("Enabled", true); |
57 | config.Set("Module", "GroupsModule"); | 84 | config.Set("Module", "GroupsModule"); |
58 | config.Set("DebugEnabled", true); | 85 | config.Set("DebugEnabled", true); |
86 | |||
87 | GroupsModule gm = new GroupsModule(); | ||
88 | EventQueueGetModule eqgm = new EventQueueGetModule(); | ||
89 | |||
90 | // We need a capabilities module active so that adding the scene presence creates an event queue in the | ||
91 | // EventQueueGetModule | ||
59 | SceneHelpers.SetupSceneModules( | 92 | SceneHelpers.SetupSceneModules( |
60 | scene, configSource, new object[] { new MockGroupsServicesConnector() }); | 93 | scene, configSource, gm, new MockGroupsServicesConnector(), new CapabilitiesModule(), eqgm); |
94 | |||
95 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseStem("1")); | ||
96 | |||
97 | gm.SendAgentGroupDataUpdate(sp.ControllingClient); | ||
98 | |||
99 | Hashtable eventsResponse = eqgm.GetEvents(UUID.Zero, sp.UUID); | ||
100 | |||
101 | Assert.That((int)eventsResponse["int_response_code"], Is.EqualTo((int)HttpStatusCode.OK)); | ||
102 | |||
103 | // Console.WriteLine("Response [{0}]", (string)eventsResponse["str_response_string"]); | ||
104 | |||
105 | OSDMap rawOsd = (OSDMap)OSDParser.DeserializeLLSDXml((string)eventsResponse["str_response_string"]); | ||
106 | OSDArray eventsOsd = (OSDArray)rawOsd["events"]; | ||
107 | |||
108 | bool foundUpdate = false; | ||
109 | foreach (OSD osd in eventsOsd) | ||
110 | { | ||
111 | OSDMap eventOsd = (OSDMap)osd; | ||
112 | |||
113 | if (eventOsd["message"] == "AgentGroupDataUpdate") | ||
114 | foundUpdate = true; | ||
115 | } | ||
116 | |||
117 | Assert.That(foundUpdate, Is.True, "Did not find AgentGroupDataUpdate in response"); | ||
118 | |||
119 | // TODO: More checking of more actual event data. | ||
61 | } | 120 | } |
62 | } | 121 | } |
63 | } \ No newline at end of file | 122 | } \ No newline at end of file |