aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-03-07 01:04:40 +0000
committerJustin Clark-Casey (justincc)2014-03-07 01:04:54 +0000
commit71918eeab4beee076d53469e8d19addab49135b7 (patch)
treea81a76fa046ffa1cada2e6759553ff3fde815edb /OpenSim/Data
parentAdd scene name to bad parcel add logging (diff)
downloadopensim-SC_OLD-71918eeab4beee076d53469e8d19addab49135b7.zip
opensim-SC_OLD-71918eeab4beee076d53469e8d19addab49135b7.tar.gz
opensim-SC_OLD-71918eeab4beee076d53469e8d19addab49135b7.tar.bz2
opensim-SC_OLD-71918eeab4beee076d53469e8d19addab49135b7.tar.xz
Add regression test for sending group notices via xmlrpc groups connector.
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/IXGroupData.cs59
-rw-r--r--OpenSim/Data/Null/NullXGroupData.cs34
2 files changed, 68 insertions, 25 deletions
diff --git a/OpenSim/Data/IXGroupData.cs b/OpenSim/Data/IXGroupData.cs
index 2965e8c..e5821ef 100644
--- a/OpenSim/Data/IXGroupData.cs
+++ b/OpenSim/Data/IXGroupData.cs
@@ -48,9 +48,57 @@ namespace OpenSim.Data
48 public ulong everyonePowers; 48 public ulong everyonePowers;
49 public ulong ownersPowers; 49 public ulong ownersPowers;
50 50
51 public Dictionary<UUID, XGroupMember> members = new Dictionary<UUID, XGroupMember>();
52 public Dictionary<UUID, XGroupNotice> notices = new Dictionary<UUID, XGroupNotice>();
53
51 public XGroup Clone() 54 public XGroup Clone()
52 { 55 {
53 return (XGroup)MemberwiseClone(); 56 XGroup clone = (XGroup)MemberwiseClone();
57 clone.members = new Dictionary<UUID, XGroupMember>();
58 clone.notices = new Dictionary<UUID, XGroupNotice>();
59
60 foreach (KeyValuePair<UUID, XGroupMember> kvp in members)
61 clone.members[kvp.Key] = kvp.Value.Clone();
62
63 foreach (KeyValuePair<UUID, XGroupNotice> kvp in notices)
64 clone.notices[kvp.Key] = kvp.Value.Clone();
65
66 return clone;
67 }
68 }
69
70 public class XGroupMember
71 {
72 public UUID agentID;
73 public UUID groupID;
74 public UUID roleID;
75 public bool acceptNotices = true;
76 public bool listInProfile = true;
77
78 public XGroupMember Clone()
79 {
80 return (XGroupMember)MemberwiseClone();
81 }
82 }
83
84 public class XGroupNotice
85 {
86 public UUID groupID;
87 public UUID noticeID;
88 public uint timestamp;
89 public string fromName;
90 public string subject;
91 public string message;
92 public byte[] binaryBucket;
93 public bool hasAttachment;
94 public int assetType;
95
96 public XGroupNotice Clone()
97 {
98 XGroupNotice clone = (XGroupNotice)MemberwiseClone();
99 clone.binaryBucket = (byte[])binaryBucket.Clone();
100
101 return clone;
54 } 102 }
55 } 103 }
56 104
@@ -58,14 +106,13 @@ namespace OpenSim.Data
58 /// Early stub interface for groups data, not final. 106 /// Early stub interface for groups data, not final.
59 /// </summary> 107 /// </summary>
60 /// <remarks> 108 /// <remarks>
61 /// Currently in-use only for regression test purposes. Needs to be filled out over time. 109 /// Currently in-use only for regression test purposes.
62 /// </remarks> 110 /// </remarks>
63 public interface IXGroupData 111 public interface IXGroupData
64 { 112 {
65 bool StoreGroup(XGroup group); 113 bool StoreGroup(XGroup group);
66 XGroup[] GetGroups(string field, string val); 114 XGroup GetGroup(UUID groupID);
67 XGroup[] GetGroups(string[] fields, string[] vals); 115 Dictionary<UUID, XGroup> GetGroups();
68 bool DeleteGroups(string field, string val); 116 bool DeleteGroup(UUID groupID);
69 bool DeleteGroups(string[] fields, string[] vals);
70 } 117 }
71} \ No newline at end of file 118} \ No newline at end of file
diff --git a/OpenSim/Data/Null/NullXGroupData.cs b/OpenSim/Data/Null/NullXGroupData.cs
index 7a86b9f..3fa9451 100644
--- a/OpenSim/Data/Null/NullXGroupData.cs
+++ b/OpenSim/Data/Null/NullXGroupData.cs
@@ -38,7 +38,7 @@ using OpenSim.Data;
38 38
39namespace OpenSim.Data.Null 39namespace OpenSim.Data.Null
40{ 40{
41 public class NullXGroupData : NullGenericDataHandler, IXGroupData 41 public class NullXGroupData : IXGroupData
42 { 42 {
43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
@@ -56,35 +56,31 @@ namespace OpenSim.Data.Null
56 return true; 56 return true;
57 } 57 }
58 58
59 public XGroup[] GetGroups(string field, string val) 59 public XGroup GetGroup(UUID groupID)
60 { 60 {
61 return GetGroups(new string[] { field }, new string[] { val }); 61 XGroup group = null;
62 }
63 62
64 public XGroup[] GetGroups(string[] fields, string[] vals)
65 {
66 lock (m_groups) 63 lock (m_groups)
67 { 64 m_groups.TryGetValue(groupID, out group);
68 List<XGroup> origGroups = Get<XGroup>(fields, vals, m_groups.Values.ToList());
69 65
70 return origGroups.Select(g => g.Clone()).ToArray(); 66 return group;
71 }
72 } 67 }
73 68
74 public bool DeleteGroups(string field, string val) 69 public Dictionary<UUID, XGroup> GetGroups()
75 { 70 {
76 return DeleteGroups(new string[] { field }, new string[] { val }); 71 Dictionary<UUID, XGroup> groupsClone = new Dictionary<UUID, XGroup>();
72
73 lock (m_groups)
74 foreach (XGroup group in m_groups.Values)
75 groupsClone[group.groupID] = group.Clone();
76
77 return groupsClone;
77 } 78 }
78 79
79 public bool DeleteGroups(string[] fields, string[] vals) 80 public bool DeleteGroup(UUID groupID)
80 { 81 {
81 lock (m_groups) 82 lock (m_groups)
82 { 83 return m_groups.Remove(groupID);
83 XGroup[] groupsToDelete = GetGroups(fields, vals);
84 Array.ForEach(groupsToDelete, g => m_groups.Remove(g.groupID));
85 }
86
87 return true;
88 } 84 }
89 } 85 }
90} \ No newline at end of file 86} \ No newline at end of file