aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-05-12 22:54:54 +0100
committerJustin Clark-Casey (justincc)2014-05-12 22:54:54 +0100
commit515d373a8e5204410797d450def00e87f7c9cd74 (patch)
tree1860568216167b139a4dd73852ad9dc3cce1ccdf /OpenSim/Region
parentReplace existing 0 timeout in internal overloaded SynchronousRestObjectReques... (diff)
downloadopensim-SC_OLD-515d373a8e5204410797d450def00e87f7c9cd74.zip
opensim-SC_OLD-515d373a8e5204410797d450def00e87f7c9cd74.tar.gz
opensim-SC_OLD-515d373a8e5204410797d450def00e87f7c9cd74.tar.bz2
opensim-SC_OLD-515d373a8e5204410797d450def00e87f7c9cd74.tar.xz
Add send group notice regression test for when MessageOnlineUsersOnly=true
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs71
1 files changed, 71 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index 71f1098..b5a10af 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -187,5 +187,76 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
187 187
188 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0)); 188 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
189 } 189 }
190
191 /// <summary>
192 /// Run test with the MessageOnlineUsersOnly flag set.
193 /// </summary>
194 [Test]
195 public void TestSendGroupNoticeOnlineOnly()
196 {
197 TestHelpers.InMethod();
198 // TestHelpers.EnableLogging();
199
200 TestScene scene = new SceneHelpers().SetupScene();
201
202 MessageTransferModule mtm = new MessageTransferModule();
203 GroupsModule gm = new GroupsModule();
204 GroupsMessagingModule gmm = new GroupsMessagingModule();
205
206 IConfigSource configSource = new IniConfigSource();
207
208 {
209 IConfig config = configSource.AddConfig("Messaging");
210 config.Set("MessageTransferModule", mtm.Name);
211 }
212
213 {
214 IConfig config = configSource.AddConfig("Groups");
215 config.Set("Enabled", true);
216 config.Set("Module", gm.Name);
217 config.Set("DebugEnabled", true);
218 config.Set("MessagingModule", gmm.Name);
219 config.Set("MessagingEnabled", true);
220 config.Set("MessageOnlineUsersOnly", true);
221 }
222
223 SceneHelpers.SetupSceneModules(scene, configSource, new MockGroupsServicesConnector(), mtm, gm, gmm);
224
225 UUID userId = TestHelpers.ParseTail(0x1);
226 string subjectText = "newman";
227 string messageText = "Hello";
228 string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
229
230 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
231 TestClient tc = (TestClient)sp.ControllingClient;
232
233 UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
234 gm.JoinGroupRequest(tc, groupID);
235
236 // Create a second user who doesn't want to receive notices
237 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
238 TestClient tc2 = (TestClient)sp2.ControllingClient;
239 gm.JoinGroupRequest(tc2, groupID);
240 gm.SetGroupAcceptNotices(tc2, groupID, false, true);
241
242 List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
243 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
244
245 List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
246 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
247
248 GridInstantMessage noticeIm = new GridInstantMessage();
249 noticeIm.fromAgentID = userId.Guid;
250 noticeIm.toAgentID = groupID.Guid;
251 noticeIm.message = combinedSubjectMessage;
252 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
253
254 tc.HandleImprovedInstantMessage(noticeIm);
255
256 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
257 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
258
259 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
260 }
190 } 261 }
191} \ No newline at end of file 262} \ No newline at end of file