diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs')
-rw-r--r-- | OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | 77 |
1 files changed, 74 insertions, 3 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs index 6fb9df1..3035cea 100644 --- a/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs +++ b/OpenSim/Tests/Common/Mock/MockGroupsServicesConnector.cs | |||
@@ -26,12 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Data; | ||
37 | using OpenSim.Data.Null; | ||
35 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
@@ -44,6 +47,8 @@ namespace OpenSim.Tests.Common.Mock | |||
44 | { | 47 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 49 | ||
50 | IXGroupData m_data = new NullXGroupData(null, null); | ||
51 | |||
47 | public string Name | 52 | public string Name |
48 | { | 53 | { |
49 | get { return "MockGroupsServicesConnector"; } | 54 | get { return "MockGroupsServicesConnector"; } |
@@ -84,7 +89,33 @@ namespace OpenSim.Tests.Common.Mock | |||
84 | int membershipFee, bool openEnrollment, bool allowPublish, | 89 | int membershipFee, bool openEnrollment, bool allowPublish, |
85 | bool maturePublish, UUID founderID) | 90 | bool maturePublish, UUID founderID) |
86 | { | 91 | { |
87 | return UUID.Zero; | 92 | XGroup group = new XGroup() |
93 | { | ||
94 | groupID = UUID.Random(), | ||
95 | ownerRoleID = UUID.Random(), | ||
96 | name = name, | ||
97 | charter = charter, | ||
98 | showInList = showInList, | ||
99 | insigniaID = insigniaID, | ||
100 | membershipFee = membershipFee, | ||
101 | openEnrollment = openEnrollment, | ||
102 | allowPublish = allowPublish, | ||
103 | maturePublish = maturePublish, | ||
104 | founderID = founderID, | ||
105 | everyonePowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultEveryonePowers, | ||
106 | ownersPowers = (ulong)XmlRpcGroupsServicesConnectorModule.DefaultOwnerPowers | ||
107 | }; | ||
108 | |||
109 | if (m_data.StoreGroup(group)) | ||
110 | { | ||
111 | m_log.DebugFormat("[MOCK GROUPS SERVICES CONNECTOR]: Created group {0} {1}", group.name, group.groupID); | ||
112 | return group.groupID; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | m_log.ErrorFormat("[MOCK GROUPS SERVICES CONNECTOR]: Failed to create group {0}", name); | ||
117 | return UUID.Zero; | ||
118 | } | ||
88 | } | 119 | } |
89 | 120 | ||
90 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, | 121 | public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, |
@@ -107,9 +138,49 @@ namespace OpenSim.Tests.Common.Mock | |||
107 | { | 138 | { |
108 | } | 139 | } |
109 | 140 | ||
110 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) | 141 | public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) |
111 | { | 142 | { |
112 | return null; | 143 | m_log.DebugFormat( |
144 | "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", | ||
145 | groupID, groupName); | ||
146 | |||
147 | XGroup[] groups; | ||
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 | |||
163 | if (groups.Length == 0) | ||
164 | return null; | ||
165 | |||
166 | XGroup xg = groups[0]; | ||
167 | |||
168 | GroupRecord gr = new GroupRecord() | ||
169 | { | ||
170 | GroupID = xg.groupID, | ||
171 | GroupName = xg.name, | ||
172 | AllowPublish = xg.allowPublish, | ||
173 | MaturePublish = xg.maturePublish, | ||
174 | Charter = xg.charter, | ||
175 | FounderID = xg.founderID, | ||
176 | // FIXME: group picture storage location unknown | ||
177 | MembershipFee = xg.membershipFee, | ||
178 | OpenEnrollment = xg.openEnrollment, | ||
179 | OwnerRoleID = xg.ownerRoleID, | ||
180 | ShowInList = xg.showInList | ||
181 | }; | ||
182 | |||
183 | return gr; | ||
113 | } | 184 | } |
114 | 185 | ||
115 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) | 186 | public GroupProfileData GetMemberGroupProfile(UUID requestingAgentID, UUID GroupID, UUID AgentID) |