diff options
author | Justin Clarke Casey | 2008-11-27 19:31:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-11-27 19:31:19 +0000 |
commit | 1cd727614dfdf097d6549cb4c4a154c984e46950 (patch) | |
tree | bb6c3f1c95247a34cfcb6e0bce1905a0247910d4 /OpenSim | |
parent | * test: Add the ability to add a plugin directory to the user and inventory s... (diff) | |
download | opensim-SC-1cd727614dfdf097d6549cb4c4a154c984e46950.zip opensim-SC-1cd727614dfdf097d6549cb4c4a154c984e46950.tar.gz opensim-SC-1cd727614dfdf097d6549cb4c4a154c984e46950.tar.bz2 opensim-SC-1cd727614dfdf097d6549cb4c4a154c984e46950.tar.xz |
* Add a file I forgot in the last commit.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs b/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs new file mode 100644 index 0000000..ab63fb9 --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Tests/TestUserDataPlugin.cs | |||
@@ -0,0 +1,124 @@ | |||
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 OpenSim 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 | |||
33 | namespace OpenSim.Region.Environment.Scenes.Tests | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// In memory user data provider. Might be quite useful as a proper user data plugin, though getting mono addins | ||
37 | /// to load any plugins when running unit tests has proven impossible so far | ||
38 | /// </summary> | ||
39 | public class TestUserDataPlugin : IUserDataPlugin | ||
40 | { | ||
41 | public string Version { get { return "0"; } } | ||
42 | |||
43 | public string Name { get { return "TestUserDataPlugin"; } } | ||
44 | |||
45 | /// <summary> | ||
46 | /// User profiles keyed by name | ||
47 | /// </summary> | ||
48 | private Dictionary<string, UserProfileData> m_userProfilesByName = new Dictionary<string, UserProfileData>(); | ||
49 | |||
50 | /// <summary> | ||
51 | /// User profiles keyed by uuid | ||
52 | /// </summary> | ||
53 | private Dictionary<UUID, UserProfileData> m_userProfilesByUuid = new Dictionary<UUID, UserProfileData>(); | ||
54 | |||
55 | public void Initialise() {} | ||
56 | |||
57 | public void Dispose() {} | ||
58 | |||
59 | public void AddNewUserProfile(UserProfileData user) | ||
60 | { | ||
61 | UpdateUserProfile(user); | ||
62 | } | ||
63 | |||
64 | public UserProfileData GetUserByUUID(UUID user) | ||
65 | { | ||
66 | UserProfileData userProfile = null; | ||
67 | m_userProfilesByUuid.TryGetValue(user, out userProfile); | ||
68 | |||
69 | return userProfile; | ||
70 | } | ||
71 | |||
72 | public UserProfileData GetUserByName(string fname, string lname) | ||
73 | { | ||
74 | UserProfileData userProfile = null; | ||
75 | m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile); | ||
76 | |||
77 | return userProfile; | ||
78 | } | ||
79 | |||
80 | public bool UpdateUserProfile(UserProfileData user) | ||
81 | { | ||
82 | m_userProfilesByUuid[user.ID] = user; | ||
83 | m_userProfilesByName[user.FirstName + " " + user.SurName] = user; | ||
84 | |||
85 | return true; | ||
86 | } | ||
87 | |||
88 | public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } | ||
89 | |||
90 | public UserAgentData GetAgentByUUID(UUID user) { return null; } | ||
91 | |||
92 | public UserAgentData GetAgentByName(string name) { return null; } | ||
93 | |||
94 | public UserAgentData GetAgentByName(string fname, string lname) { return null; } | ||
95 | |||
96 | public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {} | ||
97 | |||
98 | public void AddNewUserAgent(UserAgentData agent) {} | ||
99 | |||
100 | public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {} | ||
101 | |||
102 | public void RemoveUserFriend(UUID friendlistowner, UUID friend) {} | ||
103 | |||
104 | public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {} | ||
105 | |||
106 | public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; } | ||
107 | |||
108 | public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } | ||
109 | |||
110 | public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; } | ||
111 | |||
112 | public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; } | ||
113 | |||
114 | public void Initialise(string connect) { return; } | ||
115 | |||
116 | public AvatarAppearance GetUserAppearance(UUID user) { return null; } | ||
117 | |||
118 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {} | ||
119 | |||
120 | public void ResetAttachments(UUID userID) {} | ||
121 | |||
122 | public void LogoutUsers(UUID regionID) {} | ||
123 | } | ||
124 | } \ No newline at end of file | ||