diff options
author | Diva Canto | 2010-02-21 15:38:52 -0800 |
---|---|---|
committer | Diva Canto | 2010-02-21 15:38:52 -0800 |
commit | bb171717ceaef37b022a135209c2e0bf031d21f9 (patch) | |
tree | 2239ad031280027839b22c4f3c9df1a598a63228 /OpenSim/Tests/Common | |
parent | Bug fixes on field names in order to make data import work from old users tab... (diff) | |
download | opensim-SC-bb171717ceaef37b022a135209c2e0bf031d21f9.zip opensim-SC-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.gz opensim-SC-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.bz2 opensim-SC-bb171717ceaef37b022a135209c2e0bf031d21f9.tar.xz |
Deleted obsolete files in the Data layer. Compiles.
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs | 216 |
1 files changed, 0 insertions, 216 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs deleted file mode 100644 index 5188cf6..0000000 --- a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs +++ /dev/null | |||
@@ -1,216 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Data; | ||
33 | |||
34 | namespace OpenSim.Tests.Common.Mock | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins | ||
38 | /// to load any plugins when running unit tests has proven impossible so far. Currently no locking since unit | ||
39 | /// tests are single threaded. | ||
40 | /// </summary> | ||
41 | public class TestUserDataPlugin : IUserDataPlugin | ||
42 | { | ||
43 | public string Version { get { return "0"; } } | ||
44 | public string Name { get { return "TestUserDataPlugin"; } } | ||
45 | |||
46 | /// <summary> | ||
47 | /// User profiles keyed by name | ||
48 | /// </summary> | ||
49 | private Dictionary<string, UserProfileData> m_userProfilesByName = new Dictionary<string, UserProfileData>(); | ||
50 | |||
51 | /// <summary> | ||
52 | /// User profiles keyed by uuid | ||
53 | /// </summary> | ||
54 | private Dictionary<UUID, UserProfileData> m_userProfilesByUuid = new Dictionary<UUID, UserProfileData>(); | ||
55 | |||
56 | /// <summary> | ||
57 | /// User profiles and their agents | ||
58 | /// </summary> | ||
59 | private Dictionary<UUID, UserAgentData> m_agentByProfileUuid = new Dictionary<UUID, UserAgentData>(); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Friends list by uuid | ||
63 | /// </summary> | ||
64 | private Dictionary<UUID, List<FriendListItem>> m_friendsListByUuid = new Dictionary<UUID, List<FriendListItem>>(); | ||
65 | |||
66 | public void Initialise() {} | ||
67 | public void Dispose() {} | ||
68 | |||
69 | public void AddTemporaryUserProfile(UserProfileData userProfile) | ||
70 | { | ||
71 | // Not interested | ||
72 | } | ||
73 | |||
74 | public void AddNewUserProfile(UserProfileData user) | ||
75 | { | ||
76 | UpdateUserProfile(user); | ||
77 | } | ||
78 | |||
79 | public UserProfileData GetUserByUUID(UUID user) | ||
80 | { | ||
81 | UserProfileData userProfile = null; | ||
82 | m_userProfilesByUuid.TryGetValue(user, out userProfile); | ||
83 | |||
84 | return userProfile; | ||
85 | } | ||
86 | |||
87 | public UserProfileData GetUserByName(string fname, string lname) | ||
88 | { | ||
89 | UserProfileData userProfile = null; | ||
90 | m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile); | ||
91 | |||
92 | return userProfile; | ||
93 | } | ||
94 | |||
95 | public UserProfileData GetUserByUri(Uri uri) { return null; } | ||
96 | |||
97 | public bool UpdateUserProfile(UserProfileData user) | ||
98 | { | ||
99 | m_userProfilesByUuid[user.ID] = user; | ||
100 | m_userProfilesByName[user.FirstName + " " + user.SurName] = user; | ||
101 | |||
102 | return true; | ||
103 | } | ||
104 | |||
105 | public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } | ||
106 | |||
107 | public UserAgentData GetAgentByUUID(UUID user) | ||
108 | { | ||
109 | UserAgentData userAgent = null; | ||
110 | m_agentByProfileUuid.TryGetValue(user, out userAgent); | ||
111 | |||
112 | return userAgent; | ||
113 | } | ||
114 | |||
115 | public UserAgentData GetAgentByName(string name) | ||
116 | { | ||
117 | UserProfileData userProfile = null; | ||
118 | m_userProfilesByName.TryGetValue(name, out userProfile); | ||
119 | UserAgentData userAgent = null; | ||
120 | m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent); | ||
121 | |||
122 | return userAgent; | ||
123 | } | ||
124 | |||
125 | public UserAgentData GetAgentByName(string fname, string lname) | ||
126 | { | ||
127 | UserProfileData userProfile = GetUserByName(fname,lname); | ||
128 | UserAgentData userAgent = null; | ||
129 | m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent); | ||
130 | |||
131 | return userAgent; | ||
132 | } | ||
133 | |||
134 | public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {} | ||
135 | |||
136 | public void AddNewUserAgent(UserAgentData agent) | ||
137 | { | ||
138 | m_agentByProfileUuid[agent.ProfileID] = agent; | ||
139 | } | ||
140 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) | ||
141 | { | ||
142 | FriendListItem newfriend = new FriendListItem(); | ||
143 | newfriend.FriendPerms = perms; | ||
144 | newfriend.Friend = friend; | ||
145 | newfriend.FriendListOwner = friendlistowner; | ||
146 | |||
147 | if (!m_friendsListByUuid.ContainsKey(friendlistowner)) | ||
148 | { | ||
149 | List<FriendListItem> friendslist = new List<FriendListItem>(); | ||
150 | m_friendsListByUuid[friendlistowner] = friendslist; | ||
151 | |||
152 | } | ||
153 | m_friendsListByUuid[friendlistowner].Add(newfriend); | ||
154 | } | ||
155 | |||
156 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) | ||
157 | { | ||
158 | if (m_friendsListByUuid.ContainsKey(friendlistowner)) | ||
159 | { | ||
160 | List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner]; | ||
161 | foreach (FriendListItem frienditem in friendslist) | ||
162 | { | ||
163 | if (frienditem.Friend == friend) | ||
164 | { | ||
165 | friendslist.Remove(frienditem); | ||
166 | break; | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | } | ||
171 | |||
172 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) | ||
173 | { | ||
174 | if (m_friendsListByUuid.ContainsKey(friendlistowner)) | ||
175 | { | ||
176 | List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner]; | ||
177 | foreach (FriendListItem frienditem in friendslist) | ||
178 | { | ||
179 | if (frienditem.Friend == friend) | ||
180 | { | ||
181 | frienditem.FriendPerms = perms; | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) | ||
189 | { | ||
190 | if (m_friendsListByUuid.ContainsKey(friendlistowner)) | ||
191 | { | ||
192 | return m_friendsListByUuid[friendlistowner]; | ||
193 | } | ||
194 | else | ||
195 | return new List<FriendListItem>(); | ||
196 | |||
197 | |||
198 | } | ||
199 | |||
200 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } | ||
201 | |||
202 | public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; } | ||
203 | |||
204 | public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; } | ||
205 | |||
206 | public void Initialise(string connect) { return; } | ||
207 | |||
208 | public AvatarAppearance GetUserAppearance(UUID user) { return null; } | ||
209 | |||
210 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {} | ||
211 | |||
212 | public void ResetAttachments(UUID userID) {} | ||
213 | |||
214 | public void LogoutUsers(UUID regionID) {} | ||
215 | } | ||
216 | } | ||