aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock
diff options
context:
space:
mode:
authorSean Dague2009-01-12 15:33:56 +0000
committerSean Dague2009-01-12 15:33:56 +0000
commitd770bea2912e9fe02644183dce424193fe87ab7d (patch)
treef20c8af0363b21142738048ebe41e834db431adc /OpenSim/Tests/Common/Mock
parentCause permissions on root prims to not override folded permissions anymore (diff)
downloadopensim-SC_OLD-d770bea2912e9fe02644183dce424193fe87ab7d.zip
opensim-SC_OLD-d770bea2912e9fe02644183dce424193fe87ab7d.tar.gz
opensim-SC_OLD-d770bea2912e9fe02644183dce424193fe87ab7d.tar.bz2
opensim-SC_OLD-d770bea2912e9fe02644183dce424193fe87ab7d.tar.xz
Enhanced LoginServiceTests to test for authentication and response
Expanded TestUserDataPlugin to cover new methods From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r--OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs134
1 files changed, 108 insertions, 26 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
index 6be7b3d..8dccacc 100644
--- a/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestUserDataPlugin.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Tests.Common.Mock
38 /// tests are single threaded. 38 /// tests are single threaded.
39 /// </summary> 39 /// </summary>
40 public class TestUserDataPlugin : IUserDataPlugin 40 public class TestUserDataPlugin : IUserDataPlugin
41 { 41 {
42 public string Version { get { return "0"; } } 42 public string Version { get { return "0"; } }
43 public string Name { get { return "TestUserDataPlugin"; } } 43 public string Name { get { return "TestUserDataPlugin"; } }
44 44
@@ -49,64 +49,146 @@ namespace OpenSim.Tests.Common.Mock
49 49
50 /// <summary> 50 /// <summary>
51 /// User profiles keyed by uuid 51 /// User profiles keyed by uuid
52 /// </summary> 52 /// </summary>
53 private Dictionary<UUID, UserProfileData> m_userProfilesByUuid = new Dictionary<UUID, UserProfileData>(); 53 private Dictionary<UUID, UserProfileData> m_userProfilesByUuid = new Dictionary<UUID, UserProfileData>();
54 54
55 /// <summary>
56 /// User profiles and their agents
57 /// </summary>
58 private Dictionary<UUID, UserAgentData> m_agentByProfileUuid = new Dictionary<UUID, UserAgentData>();
59
60 /// <summary>
61 /// Friends list by uuid
62 /// </summary>
63 private Dictionary<UUID, List<FriendListItem>> m_friendsListByUuid = new Dictionary<UUID, List<FriendListItem>>();
64
55 public void Initialise() {} 65 public void Initialise() {}
56 public void Dispose() {} 66 public void Dispose() {}
57 67
58 public void AddNewUserProfile(UserProfileData user) 68 public void AddNewUserProfile(UserProfileData user)
59 { 69 {
60 UpdateUserProfile(user); 70 UpdateUserProfile(user);
61 } 71 }
62 72
63 public UserProfileData GetUserByUUID(UUID user) 73 public UserProfileData GetUserByUUID(UUID user)
64 { 74 {
65 UserProfileData userProfile = null; 75 UserProfileData userProfile = null;
66 m_userProfilesByUuid.TryGetValue(user, out userProfile); 76 m_userProfilesByUuid.TryGetValue(user, out userProfile);
67 77
68 return userProfile; 78 return userProfile;
69 } 79 }
70 80
71 public UserProfileData GetUserByName(string fname, string lname) 81 public UserProfileData GetUserByName(string fname, string lname)
72 { 82 {
73 UserProfileData userProfile = null; 83 UserProfileData userProfile = null;
74 m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile); 84 m_userProfilesByName.TryGetValue(fname + " " + lname, out userProfile);
75 85
76 return userProfile; 86 return userProfile;
77 } 87 }
78 88
79 public bool UpdateUserProfile(UserProfileData user) 89 public bool UpdateUserProfile(UserProfileData user)
80 { 90 {
81 m_userProfilesByUuid[user.ID] = user; 91 m_userProfilesByUuid[user.ID] = user;
82 m_userProfilesByName[user.FirstName + " " + user.SurName] = user; 92 m_userProfilesByName[user.FirstName + " " + user.SurName] = user;
83 93
84 return true; 94 return true;
85 } 95 }
86 96
87 public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; } 97 public List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) { return null; }
88 98
89 public UserAgentData GetAgentByUUID(UUID user) { return null; } 99 public UserAgentData GetAgentByUUID(UUID user)
100 {
101 UserAgentData userAgent = null;
102 m_agentByProfileUuid.TryGetValue(user, out userAgent);
90 103
91 public UserAgentData GetAgentByName(string name) { return null; } 104 return userAgent;
105 }
92 106
93 public UserAgentData GetAgentByName(string fname, string lname) { return null; } 107 public UserAgentData GetAgentByName(string name)
108 {
109 UserProfileData userProfile = null;
110 m_userProfilesByName.TryGetValue(name, out userProfile);
111 UserAgentData userAgent = null;
112 m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent);
113
114 return userAgent;
115 }
116
117 public UserAgentData GetAgentByName(string fname, string lname)
118 {
119 UserProfileData userProfile = GetUserByName(fname,lname);
120 UserAgentData userAgent = null;
121 m_agentByProfileUuid.TryGetValue(userProfile.ID, out userAgent);
122
123 return userAgent;
124 }
94 125
95 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {} 126 public void StoreWebLoginKey(UUID agentID, UUID webLoginKey) {}
96 127
97 public void AddNewUserAgent(UserAgentData agent) {} 128 public void AddNewUserAgent(UserAgentData agent)
129 {
130 m_agentByProfileUuid[agent.ProfileID] = agent;
131 }
132 public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
133 {
134 FriendListItem newfriend = new FriendListItem();
135 newfriend.FriendPerms = perms;
136 newfriend.Friend = friend;
137 newfriend.FriendListOwner = friendlistowner;
138
139 if (!m_friendsListByUuid.ContainsKey(friendlistowner))
140 {
141 List<FriendListItem> friendslist = new List<FriendListItem>();
142 m_friendsListByUuid[friendlistowner] = friendslist;
143
144 }
145 m_friendsListByUuid[friendlistowner].Add(newfriend);
146 }
98 147
99 public void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) {} 148 public void RemoveUserFriend(UUID friendlistowner, UUID friend)
100 149 {
101 public void RemoveUserFriend(UUID friendlistowner, UUID friend) {} 150 if (m_friendsListByUuid.ContainsKey(friendlistowner))
151 {
152 List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner];
153 foreach (FriendListItem frienditem in friendslist)
154 {
155 if (frienditem.Friend == friend)
156 {
157 friendslist.Remove(frienditem);
158 break;
159 }
160 }
161 }
162 }
102 163
103 public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) {} 164 public void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
165 {
166 if (m_friendsListByUuid.ContainsKey(friendlistowner))
167 {
168 List<FriendListItem> friendslist = m_friendsListByUuid[friendlistowner];
169 foreach (FriendListItem frienditem in friendslist)
170 {
171 if (frienditem.Friend == friend)
172 {
173 frienditem.FriendPerms = perms;
174 break;
175 }
176 }
177 }
178 }
104 179
105 public List<FriendListItem> GetUserFriendList(UUID friendlistowner) 180 public List<FriendListItem> GetUserFriendList(UUID friendlistowner)
106 { 181 {
107 return new List<FriendListItem>(); 182 if (m_friendsListByUuid.ContainsKey(friendlistowner))
183 {
184 return m_friendsListByUuid[friendlistowner];
185 }
186 else
187 return new List<FriendListItem>();
188
189
108 } 190 }
109 191
110 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; } 192 public Dictionary<UUID, FriendRegionInfo> GetFriendRegionInfos(List<UUID> uuids) { return null; }
111 193
112 public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; } 194 public bool MoneyTransferRequest(UUID from, UUID to, uint amount) { return false; }