29 using System.Collections;
30 using System.Collections.Generic;
32 using System.Reflection;
34 using NUnit.Framework;
36 using OpenMetaverse.Messages.Linden;
37 using OpenMetaverse.Packets;
38 using OpenMetaverse.StructuredData;
39 using OpenSim.Framework;
40 using OpenSim.Framework.Servers;
41 using OpenSim.Framework.Servers.HttpServer;
42 using OpenSim.Region.ClientStack.Linden;
43 using OpenSim.Region.CoreModules.Avatar.InstantMessage;
44 using OpenSim.Region.CoreModules.Framework;
45 using OpenSim.Region.Framework.Scenes;
46 using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
47 using OpenSim.Tests.Common;
67 MainServer.RemoveHttpServer(port);
70 MainServer.AddHttpServer(server);
71 MainServer.Instance = server;
134 TestHelpers.InMethod();
144 IConfigSource configSource =
new IniConfigSource();
147 IConfig config = configSource.AddConfig(
"Messaging");
148 config.Set(
"MessageTransferModule", mtm.Name);
152 IConfig config = configSource.AddConfig(
"Groups");
153 config.Set(
"Enabled",
true);
154 config.Set(
"Module", gm.Name);
155 config.Set(
"DebugEnabled",
true);
156 config.Set(
"MessagingModule", gmm.Name);
157 config.Set(
"MessagingEnabled",
true);
160 SceneHelpers.SetupSceneModules(scene, configSource, mgsc, mtm, gm, gmm);
162 UUID userId = TestHelpers.ParseTail(0x1);
163 string subjectText =
"newman";
164 string messageText =
"Hello";
165 string combinedSubjectMessage = string.Format(
"{0}|{1}", subjectText, messageText);
167 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
170 UUID groupID = gm.CreateGroup(tc,
"group1", null,
true, UUID.Zero, 0,
true,
true,
true);
171 gm.JoinGroupRequest(tc, groupID);
174 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
176 gm.JoinGroupRequest(tc2, groupID);
177 gm.SetGroupAcceptNotices(tc2, groupID,
false,
true);
179 List<GridInstantMessage> spReceivedMessages =
new List<GridInstantMessage>();
180 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
182 List<GridInstantMessage> sp2ReceivedMessages =
new List<GridInstantMessage>();
183 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
186 noticeIm.fromAgentID = userId.Guid;
187 noticeIm.toAgentID = groupID.Guid;
188 noticeIm.message = combinedSubjectMessage;
189 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
191 tc.HandleImprovedInstantMessage(noticeIm);
193 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
194 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
196 List<GroupNoticeData> notices = mgsc.GetGroupNotices(UUID.Zero, groupID);
197 Assert.AreEqual(1, notices.Count);
200 Assert.AreEqual(notices[0].NoticeID.Guid, spReceivedMessages[0].imSessionID);
202 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
211 TestHelpers.InMethod();
220 IConfigSource configSource =
new IniConfigSource();
223 IConfig config = configSource.AddConfig(
"Messaging");
224 config.Set(
"MessageTransferModule", mtm.Name);
228 IConfig config = configSource.AddConfig(
"Groups");
229 config.Set(
"Enabled",
true);
230 config.Set(
"Module", gm.Name);
231 config.Set(
"DebugEnabled",
true);
232 config.Set(
"MessagingModule", gmm.Name);
233 config.Set(
"MessagingEnabled",
true);
234 config.Set(
"MessageOnlineUsersOnly",
true);
239 UUID userId = TestHelpers.ParseTail(0x1);
240 string subjectText =
"newman";
241 string messageText =
"Hello";
242 string combinedSubjectMessage = string.Format(
"{0}|{1}", subjectText, messageText);
244 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
247 UUID groupID = gm.CreateGroup(tc,
"group1", null,
true, UUID.Zero, 0,
true,
true,
true);
248 gm.JoinGroupRequest(tc, groupID);
251 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
253 gm.JoinGroupRequest(tc2, groupID);
254 gm.SetGroupAcceptNotices(tc2, groupID,
false,
true);
256 List<GridInstantMessage> spReceivedMessages =
new List<GridInstantMessage>();
257 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
259 List<GridInstantMessage> sp2ReceivedMessages =
new List<GridInstantMessage>();
260 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
263 noticeIm.fromAgentID = userId.Guid;
264 noticeIm.toAgentID = groupID.Guid;
265 noticeIm.message = combinedSubjectMessage;
266 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
268 tc.HandleImprovedInstantMessage(noticeIm);
270 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
271 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
273 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
void TestSendAgentGroupDataUpdate()
void TestSendGroupNoticeOnlineOnly()
Run test with the MessageOnlineUsersOnly flag set.
Helpers for setting up scenes.
Basic groups module tests
Interactive OpenSim region server
void TestSendGroupNotice()