29 using System.Collections.Generic;
32 using NUnit.Framework;
34 using OpenSim.Framework;
35 using OpenSim.Framework.Servers;
36 using OpenSim.Framework.Servers.HttpServer;
37 using OpenSim.Region.CoreModules.Avatar.Chat;
38 using OpenSim.Region.CoreModules.Framework;
39 using OpenSim.Region.CoreModules.Framework.EntityTransfer;
40 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
41 using OpenSim.Region.Framework.Scenes;
42 using OpenSim.Services.Interfaces;
43 using OpenSim.Tests.Common;
44 using System.Threading;
56 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
65 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
83 IConfigSource config =
new IniConfigSource();
84 config.AddConfig(
"Chat");
85 IConfig modulesConfig = config.AddConfig(
"Modules");
86 modulesConfig.Set(
"EntityTransferModule", etmA.Name);
87 modulesConfig.Set(
"SimulationServices", lscm.Name);
89 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
104 TestHelpers.InMethod();
107 UUID sp1Uuid = TestHelpers.ParseTail(0x11);
108 UUID sp2Uuid = TestHelpers.ParseTail(0x12);
110 Vector3 sp1Position =
new Vector3(6, 128, 20);
111 Vector3 sp2Position =
new Vector3(250, 128, 20);
114 TestScene sceneWest = sh.SetupScene(
"sceneWest", TestHelpers.ParseTail(0x1), 1000, 1000);
115 TestScene sceneEast = sh.SetupScene(
"sceneEast", TestHelpers.ParseTail(0x2), 1001, 1000);
117 SetupNeighbourRegions(sceneWest, sceneEast);
119 ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneEast, sp1Uuid);
141 sp2.AbsolutePosition = sp2Position;
150 new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
151 sp1ChildClient.SceneAgent.AbsolutePosition);
155 sp2ChildClient.SceneAgent.AbsolutePosition);
157 string receivedSp1ChatMessage =
"";
158 string receivedSp2ChatMessage =
"";
160 sp1ChildClient.OnReceivedChatMessage
161 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
162 sp2ChildClient.OnReceivedChatMessage
163 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
165 TestUserInRange(sp1Client,
"ello darling", ref receivedSp2ChatMessage);
166 TestUserInRange(sp2Client,
"fantastic cats", ref receivedSp1ChatMessage);
168 sp1Position =
new Vector3(30, 128, 20);
169 sp1.AbsolutePosition = sp1Position;
178 new Vector3(sp1Position.X + sceneEast.RegionInfo.RegionSizeX, sp1Position.Y, sp1Position.Z),
179 sp1ChildClient.SceneAgent.AbsolutePosition);
181 TestUserOutOfRange(sp1Client,
"beef", ref receivedSp2ChatMessage);
182 TestUserOutOfRange(sp2Client,
"lentils", ref receivedSp1ChatMessage);
195 TestHelpers.InMethod();
198 UUID sp1Uuid = TestHelpers.ParseTail(0x11);
199 UUID sp2Uuid = TestHelpers.ParseTail(0x12);
201 Vector3 sp1Position =
new Vector3(128, 250, 20);
202 Vector3 sp2Position =
new Vector3(128, 6, 20);
205 TestScene sceneNorth = sh.SetupScene(
"sceneNorth", TestHelpers.ParseTail(0x1), 1000, 1000);
206 TestScene sceneSouth = sh.SetupScene(
"sceneSouth", TestHelpers.ParseTail(0x2), 1000, 1001);
208 SetupNeighbourRegions(sceneNorth, sceneSouth);
210 ScenePresence sp1 = SceneHelpers.AddScenePresence(sceneNorth, sp1Uuid);
232 sp2.AbsolutePosition = sp2Position;
236 sceneNorth.Update(1);
237 sceneSouth.Update(1);
241 new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
242 sp1ChildClient.SceneAgent.AbsolutePosition);
246 sp2ChildClient.SceneAgent.AbsolutePosition);
248 string receivedSp1ChatMessage =
"";
249 string receivedSp2ChatMessage =
"";
251 sp1ChildClient.OnReceivedChatMessage
252 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp1ChatMessage = message;
253 sp2ChildClient.OnReceivedChatMessage
254 += (message, type, fromPos, fromName, fromAgentID, ownerID, source, audible) => receivedSp2ChatMessage = message;
256 TestUserInRange(sp1Client,
"ello darling", ref receivedSp2ChatMessage);
257 TestUserInRange(sp2Client,
"fantastic cats", ref receivedSp1ChatMessage);
259 sp1Position =
new Vector3(30, 128, 20);
260 sp1.AbsolutePosition = sp1Position;
261 sceneNorth.Update(1);
262 sceneSouth.Update(1);
264 sceneNorth.Update(5);
265 sceneSouth.Update(5);
269 new Vector3(sp1Position.X, sp1Position.Y - sceneNorth.RegionInfo.RegionSizeY, sp1Position.Z),
270 sp1ChildClient.SceneAgent.AbsolutePosition);
272 TestUserOutOfRange(sp1Client,
"beef", ref receivedSp2ChatMessage);
273 TestUserOutOfRange(sp2Client,
"lentils", ref receivedSp1ChatMessage);
276 private void TestUserInRange(
TestClient speakClient,
string testMessage, ref
string receivedMessage)
278 receivedMessage =
"";
280 speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
282 Assert.AreEqual(testMessage, receivedMessage);
285 private void TestUserOutOfRange(
TestClient speakClient,
string testMessage, ref
string receivedMessage)
287 receivedMessage =
"";
289 speakClient.Chat(0, ChatTypeEnum.Say, testMessage);
291 Assert.AreNotEqual(testMessage, receivedMessage);
IClientAPI ControllingClient
override void Update(int frames)
Called to update the scene loop by a number of frames and until shutdown.
uint RegionSizeX
X dimension of the region.
uint RegionSizeY
X dimension of the region.
override Vector3 AbsolutePosition
Position of this avatar relative to the region the avatar is in
void TestInterRegionChatDistanceNorthSouth()
Tests chat between neighbour regions on the north-south axis
Helpers for setting up scenes.
Interactive OpenSim region server
static ScenePresence AddScenePresence(Scene scene, UUID agentId)
Add a root agent where the details of the agent connection (apart from the id) are unimportant for th...
void TestInterRegionChatDistanceEastWest()
Tests chat between neighbour regions on the east-west axis
virtual RegionInfo RegionInfo
static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)