diff options
author | Justin Clark-Casey (justincc) | 2014-03-07 01:04:40 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-03-07 01:04:54 +0000 |
commit | 71918eeab4beee076d53469e8d19addab49135b7 (patch) | |
tree | a81a76fa046ffa1cada2e6759553ff3fde815edb /OpenSim/Tests | |
parent | Add scene name to bad parcel add logging (diff) | |
download | opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.zip opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.gz opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.bz2 opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.xz |
Add regression test for sending group notices via xmlrpc groups connector.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | 152 |
1 files changed, 129 insertions, 23 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs index 3035cea..b3f8c36 100644 --- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | |||
@@ -138,33 +138,28 @@ namespace OpenSim.Tests.Common.Mock | |||
138 | { | 138 | { |
139 | } | 139 | } |
140 | 140 | ||
141 | private XGroup GetXGroup(UUID groupID, string name) | ||
142 | { | ||
143 | XGroup group = m_data.GetGroup(groupID); | ||
144 | |||
145 | |||
146 | if (group == null) | ||
147 | m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: No group found with ID {0}", groupID); | ||
148 | |||
149 | return group; | ||
150 | } | ||
151 | |||
141 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) | 152 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) |
142 | { | 153 | { |
143 | m_log.DebugFormat( | 154 | m_log.DebugFormat( |
144 | "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", | 155 | "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", |
145 | groupID, groupName); | 156 | groupID, groupName); |
146 | 157 | ||
147 | XGroup[] groups; | 158 | XGroup xg = GetXGroup(groupID, groupName); |
148 | string field, val; | ||
149 | |||
150 | if (groupID != UUID.Zero) | ||
151 | { | ||
152 | field = "groupID"; | ||
153 | val = groupID.ToString(); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | field = "name"; | ||
158 | val = groupName; | ||
159 | } | ||
160 | |||
161 | groups = m_data.GetGroups(field, val); | ||
162 | 159 | ||
163 | if (groups.Length == 0) | 160 | if (xg == null) |
164 | return null; | 161 | return null; |
165 | 162 | ||
166 | XGroup xg = groups[0]; | ||
167 | |||
168 | GroupRecord gr = new GroupRecord() | 163 | GroupRecord gr = new GroupRecord() |
169 | { | 164 | { |
170 | GroupID = xg.groupID, | 165 | GroupID = xg.groupID, |
@@ -196,8 +191,25 @@ namespace OpenSim.Tests.Common.Mock | |||
196 | { | 191 | { |
197 | } | 192 | } |
198 | 193 | ||
199 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID AgentID, UUID GroupID, bool AcceptNotices, bool ListInProfile) | 194 | public void SetAgentGroupInfo(UUID requestingAgentID, UUID agentID, UUID groupID, bool acceptNotices, bool listInProfile) |
200 | { | 195 | { |
196 | m_log.DebugFormat( | ||
197 | "[MOCK GROUPS SERVICES CONNECTOR]: SetAgentGroupInfo, requestingAgentID {0}, agentID {1}, groupID {2}, acceptNotices {3}, listInProfile {4}", | ||
198 | requestingAgentID, agentID, groupID, acceptNotices, listInProfile); | ||
199 | |||
200 | XGroup group = GetXGroup(groupID, null); | ||
201 | |||
202 | if (group == null) | ||
203 | return; | ||
204 | |||
205 | XGroupMember xgm = null; | ||
206 | if (!group.members.TryGetValue(agentID, out xgm)) | ||
207 | return; | ||
208 | |||
209 | xgm.acceptNotices = acceptNotices; | ||
210 | xgm.listInProfile = listInProfile; | ||
211 | |||
212 | m_data.StoreGroup(group); | ||
201 | } | 213 | } |
202 | 214 | ||
203 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) | 215 | public void AddAgentToGroupInvite(UUID requestingAgentID, UUID inviteID, UUID groupID, UUID roleID, UUID agentID) |
@@ -213,8 +225,27 @@ namespace OpenSim.Tests.Common.Mock | |||
213 | { | 225 | { |
214 | } | 226 | } |
215 | 227 | ||
216 | public void AddAgentToGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID, UUID RoleID) | 228 | public void AddAgentToGroup(UUID requestingAgentID, UUID agentID, UUID groupID, UUID roleID) |
217 | { | 229 | { |
230 | m_log.DebugFormat( | ||
231 | "[MOCK GROUPS SERVICES CONNECTOR]: AddAgentToGroup, requestingAgentID {0}, agentID {1}, groupID {2}, roleID {3}", | ||
232 | requestingAgentID, agentID, groupID, roleID); | ||
233 | |||
234 | XGroup group = GetXGroup(groupID, null); | ||
235 | |||
236 | if (group == null) | ||
237 | return; | ||
238 | |||
239 | XGroupMember groupMember = new XGroupMember() | ||
240 | { | ||
241 | agentID = agentID, | ||
242 | groupID = groupID, | ||
243 | roleID = roleID | ||
244 | }; | ||
245 | |||
246 | group.members[agentID] = groupMember; | ||
247 | |||
248 | m_data.StoreGroup(group); | ||
218 | } | 249 | } |
219 | 250 | ||
220 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) | 251 | public void RemoveAgentFromGroup(UUID requestingAgentID, UUID AgentID, UUID GroupID) |
@@ -259,9 +290,31 @@ namespace OpenSim.Tests.Common.Mock | |||
259 | return null; | 290 | return null; |
260 | } | 291 | } |
261 | 292 | ||
262 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID GroupID) | 293 | public List<GroupMembersData> GetGroupMembers(UUID requestingAgentID, UUID groupID) |
263 | { | 294 | { |
264 | return null; | 295 | m_log.DebugFormat( |
296 | "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupMembers, requestingAgentID {0}, groupID {1}", | ||
297 | requestingAgentID, groupID); | ||
298 | |||
299 | List<GroupMembersData> groupMembers = new List<GroupMembersData>(); | ||
300 | |||
301 | XGroup group = GetXGroup(groupID, null); | ||
302 | |||
303 | if (group == null) | ||
304 | return groupMembers; | ||
305 | |||
306 | foreach (XGroupMember xgm in group.members.Values) | ||
307 | { | ||
308 | GroupMembersData gmd = new GroupMembersData(); | ||
309 | gmd.AgentID = xgm.agentID; | ||
310 | gmd.IsOwner = group.founderID == gmd.AgentID; | ||
311 | gmd.AcceptNotices = xgm.acceptNotices; | ||
312 | gmd.ListInProfile = xgm.listInProfile; | ||
313 | |||
314 | groupMembers.Add(gmd); | ||
315 | } | ||
316 | |||
317 | return groupMembers; | ||
265 | } | 318 | } |
266 | 319 | ||
267 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) | 320 | public List<GroupRoleMembersData> GetGroupRoleMembers(UUID requestingAgentID, UUID GroupID) |
@@ -269,18 +322,71 @@ namespace OpenSim.Tests.Common.Mock | |||
269 | return null; | 322 | return null; |
270 | } | 323 | } |
271 | 324 | ||
272 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID GroupID) | 325 | public List<GroupNoticeData> GetGroupNotices(UUID requestingAgentID, UUID groupID) |
273 | { | 326 | { |
274 | return null; | 327 | return null; |
275 | } | 328 | } |
276 | 329 | ||
277 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) | 330 | public GroupNoticeInfo GetGroupNotice(UUID requestingAgentID, UUID noticeID) |
278 | { | 331 | { |
332 | m_log.DebugFormat( | ||
333 | "[MOCK GROUPS SERVICES CONNECTOR]: GetGroupNotices, requestingAgentID {0}, noticeID {1}", | ||
334 | requestingAgentID, noticeID); | ||
335 | |||
336 | // Yes, not an efficient way to do it. | ||
337 | Dictionary<UUID, XGroup> groups = m_data.GetGroups(); | ||
338 | |||
339 | foreach (XGroup group in groups.Values) | ||
340 | { | ||
341 | if (group.notices.ContainsKey(noticeID)) | ||
342 | { | ||
343 | XGroupNotice n = group.notices[noticeID]; | ||
344 | |||
345 | GroupNoticeInfo gni = new GroupNoticeInfo(); | ||
346 | gni.GroupID = n.groupID; | ||
347 | gni.Message = n.message; | ||
348 | gni.BinaryBucket = n.binaryBucket; | ||
349 | gni.noticeData.NoticeID = n.noticeID; | ||
350 | gni.noticeData.Timestamp = n.timestamp; | ||
351 | gni.noticeData.FromName = n.fromName; | ||
352 | gni.noticeData.Subject = n.subject; | ||
353 | gni.noticeData.HasAttachment = n.hasAttachment; | ||
354 | gni.noticeData.AssetType = (byte)n.assetType; | ||
355 | |||
356 | return gni; | ||
357 | } | ||
358 | } | ||
359 | |||
279 | return null; | 360 | return null; |
280 | } | 361 | } |
281 | 362 | ||
282 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) | 363 | public void AddGroupNotice(UUID requestingAgentID, UUID groupID, UUID noticeID, string fromName, string subject, string message, byte[] binaryBucket) |
283 | { | 364 | { |
365 | m_log.DebugFormat( | ||
366 | "[MOCK GROUPS SERVICES CONNECTOR]: AddGroupNotice, requestingAgentID {0}, groupID {1}, noticeID {2}, fromName {3}, subject {4}, message {5}, binaryBucket.Length {6}", | ||
367 | requestingAgentID, groupID, noticeID, fromName, subject, message, binaryBucket.Length); | ||
368 | |||
369 | XGroup group = GetXGroup(groupID, null); | ||
370 | |||
371 | if (group == null) | ||
372 | return; | ||
373 | |||
374 | XGroupNotice groupNotice = new XGroupNotice() | ||
375 | { | ||
376 | groupID = groupID, | ||
377 | noticeID = noticeID, | ||
378 | fromName = fromName, | ||
379 | subject = subject, | ||
380 | message = message, | ||
381 | timestamp = (uint)Util.UnixTimeSinceEpoch(), | ||
382 | hasAttachment = false, | ||
383 | assetType = 0, | ||
384 | binaryBucket = binaryBucket | ||
385 | }; | ||
386 | |||
387 | group.notices[noticeID] = groupNotice; | ||
388 | |||
389 | m_data.StoreGroup(group); | ||
284 | } | 390 | } |
285 | 391 | ||
286 | public void ResetAgentGroupChatSessions(UUID agentID) | 392 | public void ResetAgentGroupChatSessions(UUID agentID) |