29 using System.Collections;
30 using System.Collections.Generic;
34 using NUnit.Framework;
36 using OpenMetaverse.Packets;
37 using OpenMetaverse.StructuredData;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Servers;
40 using OpenSim.Framework.Servers.HttpServer;
41 using OpenSim.Region.ClientStack.Linden;
42 using OpenSim.Region.CoreModules.Framework;
43 using OpenSim.Region.Framework.Scenes;
44 using OpenSim.Region.OptionalModules.World.NPC;
45 using OpenSim.Tests.Common;
66 MainServer.RemoveHttpServer(port);
69 MainServer.AddHttpServer(server);
70 MainServer.Instance = server;
72 IConfigSource config =
new IniConfigSource();
73 config.AddConfig(
"Startup");
74 config.Configs[
"Startup"].Set(
"EventQueue",
"true");
80 config.AddConfig(
"NPC");
81 config.Configs[
"NPC"].Set(
"Enabled",
"true");
85 SceneHelpers.SetupSceneModules(m_scene, config, capsModule, m_eqgMod, m_npcMod);
91 TestHelpers.InMethod();
94 SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
97 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(1));
103 TestHelpers.InMethod();
106 UUID spId = TestHelpers.ParseTail(0x1);
108 SceneHelpers.AddScenePresence(m_scene, spId);
109 m_scene.CloseAgent(spId,
false);
112 Assert.That(MainServer.Instance.GetPollServiceHandlerKeys().Count, Is.EqualTo(0));
118 TestHelpers.InMethod();
121 ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
123 string messageName =
"TestMessage";
125 m_eqgMod.Enqueue(m_eqgMod.BuildEvent(messageName,
new OSDMap()), sp.UUID);
127 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
130 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
131 if((
int)eventsResponse[
"int_response_code"] != (int)HttpStatusCode.OK)
133 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
134 if((
int)eventsResponse[
"int_response_code"] != (int)HttpStatusCode.OK)
135 eventsResponse = m_eqgMod.GetEvents(UUID.Zero, sp.UUID);
138 Assert.That((int)eventsResponse[
"int_response_code"], Is.EqualTo((
int)HttpStatusCode.OK));
142 OSDMap rawOsd = (
OSDMap)OSDParser.DeserializeLLSDXml((
string)eventsResponse[
"str_response_string"]);
145 bool foundUpdate =
false;
146 foreach (
OSD osd
in eventsOsd)
150 if (eventOsd[
"message"] == messageName)
154 Assert.That(foundUpdate, Is.True, string.Format(
"Did not find {0} in response", messageName));
163 TestHelpers.InMethod();
164 TestHelpers.EnableLogging();
166 string messageName =
"TestMessage";
170 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, TestHelpers.ParseTail(0x1));
172 Assert.That((int)eventsResponse[
"int_response_code"], Is.EqualTo((
int)HttpStatusCode.BadGateway));
181 TestHelpers.InMethod();
185 = m_npcMod.CreateNPC(
186 "John",
"Smith",
new Vector3(128, 128, 30), UUID.Zero,
true, m_scene,
new AvatarAppearance());
190 string messageName =
"TestMessage";
192 m_eqgMod.Enqueue(m_eqgMod.BuildEvent(messageName,
new OSDMap()), npc.UUID);
194 Hashtable eventsResponse = m_eqgMod.GetEvents(UUID.Zero, npc.UUID);
196 Assert.That((int)eventsResponse[
"int_response_code"], Is.EqualTo((
int)HttpStatusCode.BadGateway));
void TestEnqueueMessageNoUser()
Test an attempt to put a message on the queue of a user that is not in the region.
void TestEnqueueMessage()
OpenMetaverse.StructuredData.OSDArray OSDArray
Contains the Avatar's Appearance and methods to manipulate the appearance.
OpenMetaverse.StructuredData.OSDMap OSDMap
static UUID ParseTail(int tail)
Parse tail section into full UUID.
void TestRemoveForClient()
OpenMetaverse.StructuredData.OSD OSD
Helpers for setting up scenes.
Interactive OpenSim region server
void TestEnqueueMessageToNpc()
NPCs do not currently have an event queue but a caller may try to send a message anyway, so check behaviour.