aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs')
-rw-r--r--OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs123
1 files changed, 123 insertions, 0 deletions
diff --git a/OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs
new file mode 100644
index 0000000..c08fc90
--- /dev/null
+++ b/OpenSim/Tests/Infra/Mock/TestUserDataPlugin.cs
@@ -0,0 +1,123 @@
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
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32
33namespace OpenSim.Tests.Infra.Mock
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. Currently no locking since unit
38 /// tests are single threaded.
39 /// </summary>
40 public class TestUserDataPlugin : IUserDataPlugin
41 {
42 public string Version { get { return "0"; } }
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 public void Dispose() {}
57
58 public void AddNewUserProfile(UserProfileData user)
59 {
60 UpdateUserProfile(user);
61 }
62
63 public UserProfileData GetUserByUUID(UUID user)
64 {
65 UserProfileData userProfile = null;
66 m_userProfilesByUuid.TryGetValue(user, out userProfile);
67
68 return userProfile;
69 }
70
71 public UserProfileData GetUserByName(string fname, string lname)
72 {
73 UserProfileData userProfile = null;
74 m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile);
75
76 return userProfile;
77 }
78
79 public bool UpdateUserProfile(UserProfileData user)
80 {
81 m_userProfilesByUuid[user.ID] = user;
82 m_userProfilesByName[user.FirstName + " " + user.SurName] = user;
83
84 return true;
85 }
86
87 public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
88
89 public UserAgentData GetAgentByUUID(UUID user) { return null; }
90
91 public UserAgentData GetAgentByName(string name) { return null; }
92
93 public UserAgentData GetAgentByName(string fname, string lname) { return null; }
94
95 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {}
96
97 public void AddNewUserAgent(UserAgentData agent) {}
98
99 public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {}
100
101 public void RemoveUserFriend(UUID friendlistowner, UUID friend) {}
102
103 public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {}
104
105 public List<FriendListItem> GetUserFriendList(UUID friendlistowner) { return null; }
106
107 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; }
108
109 public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }
110
111 public bool InventoryTransferRequest(UUID from, UUID to, UUID inventory) { return false; }
112
113 public void Initialise(string connect) { return; }
114
115 public AvatarAppearance GetUserAppearance(UUID user) { return null; }
116
117 public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) {}
118
119 public void ResetAttachments(UUID userID) {}
120
121 public void LogoutUsers(UUID regionID) {}
122 }
123} \ No newline at end of file