diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLManager.cs | 38 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicUserTest.cs | 172 |
3 files changed, 162 insertions, 52 deletions
diff --git a/OpenSim/Data/MySQL/MySQLManager.cs b/OpenSim/Data/MySQL/MySQLManager.cs index c584eb9..a54c020 100644 --- a/OpenSim/Data/MySQL/MySQLManager.cs +++ b/OpenSim/Data/MySQL/MySQLManager.cs | |||
@@ -561,7 +561,7 @@ namespace OpenSim.Data.MySQL | |||
561 | 561 | ||
562 | retval.Created = Convert.ToInt32(reader["created"].ToString()); | 562 | retval.Created = Convert.ToInt32(reader["created"].ToString()); |
563 | retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); | 563 | retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); |
564 | 564 | ||
565 | retval.UserInventoryURI = (string) reader["userInventoryURI"]; | 565 | retval.UserInventoryURI = (string) reader["userInventoryURI"]; |
566 | retval.UserAssetURI = (string) reader["userAssetURI"]; | 566 | retval.UserAssetURI = (string) reader["userAssetURI"]; |
567 | 567 | ||
@@ -751,6 +751,7 @@ namespace OpenSim.Data.MySQL | |||
751 | /// <param name="passwordHash">A salted hash of the users password</param> | 751 | /// <param name="passwordHash">A salted hash of the users password</param> |
752 | /// <param name="passwordSalt">The salt used for the password hash</param> | 752 | /// <param name="passwordSalt">The salt used for the password hash</param> |
753 | /// <param name="homeRegion">A regionHandle of the users home region</param> | 753 | /// <param name="homeRegion">A regionHandle of the users home region</param> |
754 | /// <param name="homeRegionID"> The UUID of the user's home region</param> | ||
754 | /// <param name="homeLocX">Home region position vector</param> | 755 | /// <param name="homeLocX">Home region position vector</param> |
755 | /// <param name="homeLocY">Home region position vector</param> | 756 | /// <param name="homeLocY">Home region position vector</param> |
756 | /// <param name="homeLocZ">Home region position vector</param> | 757 | /// <param name="homeLocZ">Home region position vector</param> |
@@ -770,22 +771,22 @@ namespace OpenSim.Data.MySQL | |||
770 | /// <param name="webLoginKey">Ignored</param> | 771 | /// <param name="webLoginKey">Ignored</param> |
771 | /// <returns>Success?</returns> | 772 | /// <returns>Success?</returns> |
772 | public bool insertUserRow(UUID uuid, string username, string lastname, string email, string passwordHash, | 773 | public bool insertUserRow(UUID uuid, string username, string lastname, string email, string passwordHash, |
773 | string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, | 774 | string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ, |
774 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, | 775 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, |
775 | string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, | 776 | string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, |
776 | string aboutText, string firstText, | 777 | string aboutText, string firstText, |
777 | UUID profileImage, UUID firstImage, UUID webLoginKey) | 778 | UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner) |
778 | { | 779 | { |
779 | m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString()); | 780 | m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString()); |
780 | string sql = | 781 | string sql = |
781 | "INSERT INTO users (`UUID`, `username`, `lastname`, `email`, `passwordHash`, `passwordSalt`, `homeRegion`, "; | 782 | "INSERT INTO users (`UUID`, `username`, `lastname`, `email`, `passwordHash`, `passwordSalt`, `homeRegion`, `homeRegionID`, "; |
782 | sql += | 783 | sql += |
783 | "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; | 784 | "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; |
784 | sql += | 785 | sql += |
785 | "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; | 786 | "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; |
786 | sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES "; | 787 | sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES "; |
787 | 788 | ||
788 | sql += "(?UUID, ?username, ?lastname, ?email, ?passwordHash, ?passwordSalt, ?homeRegion, "; | 789 | sql += "(?UUID, ?username, ?lastname, ?email, ?passwordHash, ?passwordSalt, ?homeRegion, ?homeRegionID, "; |
789 | sql += | 790 | sql += |
790 | "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; | 791 | "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, "; |
791 | sql += | 792 | sql += |
@@ -800,6 +801,7 @@ namespace OpenSim.Data.MySQL | |||
800 | parameters["?passwordHash"] = passwordHash; | 801 | parameters["?passwordHash"] = passwordHash; |
801 | parameters["?passwordSalt"] = passwordSalt; | 802 | parameters["?passwordSalt"] = passwordSalt; |
802 | parameters["?homeRegion"] = homeRegion.ToString(); | 803 | parameters["?homeRegion"] = homeRegion.ToString(); |
804 | parameters["?homeRegionID"] = homeRegionID.ToString(); | ||
803 | parameters["?homeLocationX"] = homeLocX.ToString(); | 805 | parameters["?homeLocationX"] = homeLocX.ToString(); |
804 | parameters["?homeLocationY"] = homeLocY.ToString(); | 806 | parameters["?homeLocationY"] = homeLocY.ToString(); |
805 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | 807 | parameters["?homeLocationZ"] = homeLocZ.ToString(); |
@@ -808,23 +810,21 @@ namespace OpenSim.Data.MySQL | |||
808 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | 810 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); |
809 | parameters["?created"] = created.ToString(); | 811 | parameters["?created"] = created.ToString(); |
810 | parameters["?lastLogin"] = lastlogin.ToString(); | 812 | parameters["?lastLogin"] = lastlogin.ToString(); |
811 | parameters["?userInventoryURI"] = String.Empty; | 813 | parameters["?userInventoryURI"] = inventoryURI; |
812 | parameters["?userAssetURI"] = String.Empty; | 814 | parameters["?userAssetURI"] = assetURI; |
813 | parameters["?profileCanDoMask"] = "0"; | 815 | parameters["?profileCanDoMask"] = canDoMask.ToString(); |
814 | parameters["?profileWantDoMask"] = "0"; | 816 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); |
815 | parameters["?profileAboutText"] = aboutText; | 817 | parameters["?profileAboutText"] = aboutText; |
816 | parameters["?profileFirstText"] = firstText; | 818 | parameters["?profileFirstText"] = firstText; |
817 | parameters["?profileImage"] = profileImage.ToString(); | 819 | parameters["?profileImage"] = profileImage.ToString(); |
818 | parameters["?profileFirstImage"] = firstImage.ToString(); | 820 | parameters["?profileFirstImage"] = firstImage.ToString(); |
819 | parameters["?webLoginKey"] = string.Empty; | 821 | parameters["?webLoginKey"] = webLoginKey.ToString(); |
820 | parameters["?userFlags"] = "0"; | 822 | parameters["?userFlags"] = userFlags.ToString(); |
821 | parameters["?godLevel"] = "0"; | 823 | parameters["?godLevel"] = godLevel.ToString(); |
822 | parameters["?customType"] = ""; | 824 | parameters["?customType"] = customType == null ? "" : customType; |
823 | parameters["?partner"] = ""; | 825 | parameters["?partner"] = partner.ToString(); |
824 | |||
825 | |||
826 | bool returnval = false; | 826 | bool returnval = false; |
827 | 827 | ||
828 | try | 828 | try |
829 | { | 829 | { |
830 | IDbCommand result = Query(sql, parameters); | 830 | IDbCommand result = Query(sql, parameters); |
@@ -911,8 +911,8 @@ namespace OpenSim.Data.MySQL | |||
911 | parameters["?lastLogin"] = lastlogin.ToString(); | 911 | parameters["?lastLogin"] = lastlogin.ToString(); |
912 | parameters["?userInventoryURI"] = inventoryURI; | 912 | parameters["?userInventoryURI"] = inventoryURI; |
913 | parameters["?userAssetURI"] = assetURI; | 913 | parameters["?userAssetURI"] = assetURI; |
914 | parameters["?profileCanDoMask"] = "0"; | 914 | parameters["?profileCanDoMask"] = canDoMask.ToString(); |
915 | parameters["?profileWantDoMask"] = "0"; | 915 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); |
916 | parameters["?profileAboutText"] = aboutText; | 916 | parameters["?profileAboutText"] = aboutText; |
917 | parameters["?profileFirstText"] = firstText; | 917 | parameters["?profileFirstText"] = firstText; |
918 | parameters["?profileImage"] = profileImage.ToString(); | 918 | parameters["?profileImage"] = profileImage.ToString(); |
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index 47670d2..82b5bbc 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -643,13 +643,13 @@ namespace OpenSim.Data.MySQL | |||
643 | try | 643 | try |
644 | { | 644 | { |
645 | dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, | 645 | dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt, |
646 | user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y, | 646 | user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, |
647 | user.HomeLocation.Z, | 647 | user.HomeLocation.Z, |
648 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, | 648 | user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, |
649 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, | 649 | user.LastLogin, user.UserInventoryURI, user.UserAssetURI, |
650 | user.CanDoMask, user.WantDoMask, | 650 | user.CanDoMask, user.WantDoMask, |
651 | user.AboutText, user.FirstLifeAboutText, user.Image, | 651 | user.AboutText, user.FirstLifeAboutText, user.Image, |
652 | user.FirstLifeImage, user.WebLoginKey); | 652 | user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel, user.CustomType, user.Partner); |
653 | } | 653 | } |
654 | catch (Exception e) | 654 | catch (Exception e) |
655 | { | 655 | { |
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index ba6da68..e9e61d0 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs | |||
@@ -46,6 +46,7 @@ namespace OpenSim.Data.Tests | |||
46 | public UUID user2; | 46 | public UUID user2; |
47 | public UUID user3; | 47 | public UUID user3; |
48 | public UUID user4; | 48 | public UUID user4; |
49 | public UUID user5; | ||
49 | public UUID webkey; | 50 | public UUID webkey; |
50 | public UUID zero = UUID.Zero; | 51 | public UUID zero = UUID.Zero; |
51 | public static Random random; | 52 | public static Random random; |
@@ -81,6 +82,7 @@ namespace OpenSim.Data.Tests | |||
81 | user2 = UUID.Random(); | 82 | user2 = UUID.Random(); |
82 | user3 = UUID.Random(); | 83 | user3 = UUID.Random(); |
83 | user4 = UUID.Random(); | 84 | user4 = UUID.Random(); |
85 | user5 = UUID.Random(); | ||
84 | agent1 = UUID.Random(); | 86 | agent1 = UUID.Random(); |
85 | agent2 = UUID.Random(); | 87 | agent2 = UUID.Random(); |
86 | agent3 = UUID.Random(); | 88 | agent3 = UUID.Random(); |
@@ -191,20 +193,20 @@ namespace OpenSim.Data.Tests | |||
191 | public void T015_UserPersistency() | 193 | public void T015_UserPersistency() |
192 | { | 194 | { |
193 | UserProfileData u = new UserProfileData(); | 195 | UserProfileData u = new UserProfileData(); |
194 | UUID id = UUID.Random(); | 196 | UUID id = user5; |
195 | string fname = RandomName(); | 197 | string fname = RandomName(); |
196 | string lname = RandomName(); | 198 | string lname = RandomName(); |
199 | string email = RandomName(); | ||
197 | string passhash = RandomName(); | 200 | string passhash = RandomName(); |
198 | string passsalt = RandomName(); | 201 | string passsalt = RandomName(); |
199 | UUID homeregion = UUID.Random(); | 202 | UUID homeregion = UUID.Random(); |
200 | UUID webloginkey = UUID.Random(); | 203 | UUID webloginkey = UUID.Random(); |
201 | uint homeregx = (uint) random.Next(); | 204 | uint homeregx = (uint) random.Next(); |
202 | uint homeregy = (uint) random.Next(); | 205 | uint homeregy = (uint) random.Next(); |
203 | Vector3 homeloc = new Vector3((float) random.NextDouble(),(float) random.NextDouble(),(float) random.NextDouble()); | 206 | Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); |
204 | Vector3 homelookat = new Vector3((float)random.NextDouble(),(float)random.NextDouble(),(float)random.NextDouble()); | 207 | Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); |
205 | int created = random.Next(); | 208 | int created = random.Next(); |
206 | int lastlogin = random.Next(); | 209 | int lastlogin = random.Next(); |
207 | UUID rootinvfolder = UUID.Random(); | ||
208 | string userinvuri = RandomName(); | 210 | string userinvuri = RandomName(); |
209 | string userasseturi = RandomName(); | 211 | string userasseturi = RandomName(); |
210 | uint candomask = (uint) random.Next(); | 212 | uint candomask = (uint) random.Next(); |
@@ -219,20 +221,25 @@ namespace OpenSim.Data.Tests | |||
219 | string customtype = RandomName(); | 221 | string customtype = RandomName(); |
220 | UUID partner = UUID.Random(); | 222 | UUID partner = UUID.Random(); |
221 | 223 | ||
224 | //HomeRegionX and HomeRegionY must only use 24 bits | ||
225 | homeregx = ((homeregx << 8) >> 8); | ||
226 | homeregy = ((homeregy << 8) >> 8); | ||
227 | |||
222 | u.ID = id; | 228 | u.ID = id; |
223 | u.WebLoginKey = webloginkey; | 229 | u.WebLoginKey = webloginkey; |
224 | u.HomeRegionID = homeregion; | 230 | u.HomeRegionID = homeregion; |
225 | u.FirstName = fname; | 231 | u.FirstName = fname; |
226 | u.SurName = lname; | 232 | u.SurName = lname; |
233 | u.Email = email; | ||
227 | u.PasswordHash = passhash; | 234 | u.PasswordHash = passhash; |
228 | u.PasswordSalt = passsalt; | 235 | u.PasswordSalt = passsalt; |
229 | u.HomeRegionX = homeregx; | 236 | u.HomeRegionX = homeregx; |
230 | u.HomeRegionY = homeregy; | 237 | u.HomeRegionY = homeregy; |
238 | ulong homereg = u.HomeRegion; | ||
231 | u.HomeLocation = homeloc; | 239 | u.HomeLocation = homeloc; |
232 | u.HomeLookAt = homelookat; | 240 | u.HomeLookAt = homelookat; |
233 | u.Created = created; | 241 | u.Created = created; |
234 | u.LastLogin = lastlogin; | 242 | u.LastLogin = lastlogin; |
235 | u.RootInventoryFolderID = rootinvfolder; | ||
236 | u.UserInventoryURI = userinvuri; | 243 | u.UserInventoryURI = userinvuri; |
237 | u.UserAssetURI = userasseturi; | 244 | u.UserAssetURI = userasseturi; |
238 | u.CanDoMask = candomask; | 245 | u.CanDoMask = candomask; |
@@ -250,34 +257,138 @@ namespace OpenSim.Data.Tests | |||
250 | db.AddNewUserProfile(u); | 257 | db.AddNewUserProfile(u); |
251 | UserProfileData u1a = db.GetUserByUUID(id); | 258 | UserProfileData u1a = db.GetUserByUUID(id); |
252 | Assert.That(u1a,Is.Not.Null); | 259 | Assert.That(u1a,Is.Not.Null); |
253 | Assert.That(homeregion,Is.EqualTo(u.HomeRegionID)); | 260 | Assert.That(id,Is.EqualTo(u1a.ID)); |
254 | Assert.That(webloginkey,Is.EqualTo(u.WebLoginKey)); | 261 | Assert.That(homeregion,Is.EqualTo(u1a.HomeRegionID)); |
255 | Assert.That(fname,Is.EqualTo(u.FirstName)); | 262 | Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey)); |
256 | Assert.That(lname,Is.EqualTo(u.SurName)); | 263 | Assert.That(fname,Is.EqualTo(u1a.FirstName)); |
257 | Assert.That(passhash,Is.EqualTo(u.PasswordHash)); | 264 | Assert.That(lname,Is.EqualTo(u1a.SurName)); |
258 | Assert.That(passsalt,Is.EqualTo(u.PasswordSalt)); | 265 | Assert.That(email,Is.EqualTo(u1a.Email)); |
259 | Assert.That(homeregx,Is.EqualTo(u.HomeRegionX)); | 266 | Assert.That(passhash,Is.EqualTo(u1a.PasswordHash)); |
260 | Assert.That(homeregy,Is.EqualTo(u.HomeRegionY)); | 267 | Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt)); |
261 | Assert.That(homeloc,Is.EqualTo(u.HomeLocation)); | 268 | Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX)); |
262 | Assert.That(homelookat,Is.EqualTo(u.HomeLookAt)); | 269 | Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY)); |
263 | Assert.That(created,Is.EqualTo(u.Created)); | 270 | Assert.That(homereg,Is.EqualTo(u1a.HomeRegion)); |
264 | Assert.That(lastlogin,Is.EqualTo(u.LastLogin)); | 271 | Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation)); |
265 | Assert.That(rootinvfolder,Is.EqualTo(u.RootInventoryFolderID)); | 272 | Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt)); |
266 | Assert.That(userinvuri,Is.EqualTo(u.UserInventoryURI)); | 273 | Assert.That(created,Is.EqualTo(u1a.Created)); |
267 | Assert.That(userasseturi,Is.EqualTo(u.UserAssetURI)); | 274 | Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin)); |
268 | Assert.That(candomask,Is.EqualTo(u.CanDoMask)); | 275 | // RootInventoryFolderID is not tested because it is saved in SQLite, |
269 | Assert.That(abouttext,Is.EqualTo(u.AboutText)); | 276 | // but not in MySQL |
270 | Assert.That(flabouttext,Is.EqualTo(u.FirstLifeAboutText)); | 277 | Assert.That(userinvuri,Is.EqualTo(u1a.UserInventoryURI)); |
271 | Assert.That(image,Is.EqualTo(u.Image)); | 278 | Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI)); |
272 | Assert.That(firstimage,Is.EqualTo(u.FirstLifeImage)); | 279 | Assert.That(candomask,Is.EqualTo(u1a.CanDoMask)); |
273 | Assert.That(agent,Is.EqualTo(u.CurrentAgent)); | 280 | Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask)); |
274 | Assert.That(userflags,Is.EqualTo(u.UserFlags)); | 281 | Assert.That(abouttext,Is.EqualTo(u1a.AboutText)); |
275 | Assert.That(godlevel,Is.EqualTo(u.GodLevel)); | 282 | Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText)); |
276 | Assert.That(customtype,Is.EqualTo(u.CustomType)); | 283 | Assert.That(image,Is.EqualTo(u1a.Image)); |
277 | Assert.That(partner,Is.EqualTo(u.Partner)); | 284 | Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage)); |
285 | Assert.That(u1a.CurrentAgent,Is.Null); | ||
286 | Assert.That(userflags,Is.EqualTo(u1a.UserFlags)); | ||
287 | Assert.That(godlevel,Is.EqualTo(u1a.GodLevel)); | ||
288 | Assert.That(customtype,Is.EqualTo(u1a.CustomType)); | ||
289 | Assert.That(partner,Is.EqualTo(u1a.Partner)); | ||
278 | } | 290 | } |
279 | 291 | ||
280 | [Test] | 292 | [Test] |
293 | public void T016_UserUpdatePersistency() | ||
294 | { | ||
295 | UUID id = user5; | ||
296 | UserProfileData u = db.GetUserByUUID(id); | ||
297 | string fname = RandomName(); | ||
298 | string lname = RandomName(); | ||
299 | string email = RandomName(); | ||
300 | string passhash = RandomName(); | ||
301 | string passsalt = RandomName(); | ||
302 | UUID homeregionid = UUID.Random(); | ||
303 | UUID webloginkey = UUID.Random(); | ||
304 | uint homeregx = (uint) random.Next(); | ||
305 | uint homeregy = (uint) random.Next(); | ||
306 | Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); | ||
307 | Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); | ||
308 | int created = random.Next(); | ||
309 | int lastlogin = random.Next(); | ||
310 | string userinvuri = RandomName(); | ||
311 | string userasseturi = RandomName(); | ||
312 | uint candomask = (uint) random.Next(); | ||
313 | uint wantdomask = (uint) random.Next(); | ||
314 | string abouttext = RandomName(); | ||
315 | string flabouttext = RandomName(); | ||
316 | UUID image = UUID.Random(); | ||
317 | UUID firstimage = UUID.Random(); | ||
318 | UserAgentData agent = NewAgent(id,UUID.Random()); | ||
319 | int userflags = random.Next(); | ||
320 | int godlevel = random.Next(); | ||
321 | string customtype = RandomName(); | ||
322 | UUID partner = UUID.Random(); | ||
323 | |||
324 | //HomeRegionX and HomeRegionY must only use 24 bits | ||
325 | homeregx = ((homeregx << 8) >> 8); | ||
326 | homeregy = ((homeregy << 8) >> 8); | ||
327 | |||
328 | u.WebLoginKey = webloginkey; | ||
329 | u.HomeRegionID = homeregionid; | ||
330 | u.FirstName = fname; | ||
331 | u.SurName = lname; | ||
332 | u.Email = email; | ||
333 | u.PasswordHash = passhash; | ||
334 | u.PasswordSalt = passsalt; | ||
335 | u.HomeRegionX = homeregx; | ||
336 | u.HomeRegionY = homeregy; | ||
337 | ulong homereg = u.HomeRegion; | ||
338 | u.HomeLocation = homeloc; | ||
339 | u.HomeLookAt = homelookat; | ||
340 | u.Created = created; | ||
341 | u.LastLogin = lastlogin; | ||
342 | u.UserInventoryURI = userinvuri; | ||
343 | u.UserAssetURI = userasseturi; | ||
344 | u.CanDoMask = candomask; | ||
345 | u.WantDoMask = wantdomask; | ||
346 | u.AboutText = abouttext; | ||
347 | u.FirstLifeAboutText = flabouttext; | ||
348 | u.Image = image; | ||
349 | u.FirstLifeImage = firstimage; | ||
350 | u.CurrentAgent = agent; | ||
351 | u.UserFlags = userflags; | ||
352 | u.GodLevel = godlevel; | ||
353 | u.CustomType = customtype; | ||
354 | u.Partner = partner; | ||
355 | |||
356 | db.UpdateUserProfile(u); | ||
357 | UserProfileData u1a = db.GetUserByUUID(id); | ||
358 | Assert.That(u1a,Is.Not.Null); | ||
359 | Assert.That(id,Is.EqualTo(u1a.ID)); | ||
360 | Assert.That(homeregionid,Is.EqualTo(u1a.HomeRegionID)); | ||
361 | Assert.That(webloginkey,Is.EqualTo(u1a.WebLoginKey)); | ||
362 | Assert.That(fname,Is.EqualTo(u1a.FirstName)); | ||
363 | Assert.That(lname,Is.EqualTo(u1a.SurName)); | ||
364 | Assert.That(email,Is.EqualTo(u1a.Email)); | ||
365 | Assert.That(passhash,Is.EqualTo(u1a.PasswordHash)); | ||
366 | Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt)); | ||
367 | Assert.That(homereg,Is.EqualTo(u1a.HomeRegion)); | ||
368 | Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX)); | ||
369 | Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY)); | ||
370 | Assert.That(homereg,Is.EqualTo(u1a.HomeRegion)); | ||
371 | Assert.That(homeloc,Is.EqualTo(u1a.HomeLocation)); | ||
372 | Assert.That(homelookat,Is.EqualTo(u1a.HomeLookAt)); | ||
373 | Assert.That(created,Is.EqualTo(u1a.Created)); | ||
374 | Assert.That(lastlogin,Is.EqualTo(u1a.LastLogin)); | ||
375 | // RootInventoryFolderID is not tested because it is saved in SQLite, | ||
376 | // but not in MySQL | ||
377 | Assert.That(userasseturi,Is.EqualTo(u1a.UserAssetURI)); | ||
378 | Assert.That(candomask,Is.EqualTo(u1a.CanDoMask)); | ||
379 | Assert.That(wantdomask,Is.EqualTo(u1a.WantDoMask)); | ||
380 | Assert.That(abouttext,Is.EqualTo(u1a.AboutText)); | ||
381 | Assert.That(flabouttext,Is.EqualTo(u1a.FirstLifeAboutText)); | ||
382 | Assert.That(image,Is.EqualTo(u1a.Image)); | ||
383 | Assert.That(firstimage,Is.EqualTo(u1a.FirstLifeImage)); | ||
384 | Assert.That(u1a.CurrentAgent,Is.Null); | ||
385 | Assert.That(userflags,Is.EqualTo(u1a.UserFlags)); | ||
386 | Assert.That(godlevel,Is.EqualTo(u1a.GodLevel)); | ||
387 | Assert.That(customtype,Is.EqualTo(u1a.CustomType)); | ||
388 | Assert.That(partner,Is.EqualTo(u1a.Partner)); | ||
389 | } | ||
390 | |||
391 | [Test] | ||
281 | public void T020_CreateAgent() | 392 | public void T020_CreateAgent() |
282 | { | 393 | { |
283 | UserAgentData a1 = NewAgent(user1,agent1); | 394 | UserAgentData a1 = NewAgent(user1,agent1); |
@@ -394,7 +505,6 @@ namespace OpenSim.Data.Tests | |||
394 | u.SurName = lname; | 505 | u.SurName = lname; |
395 | u.PasswordHash = "NOTAHASH"; | 506 | u.PasswordHash = "NOTAHASH"; |
396 | u.PasswordSalt = "NOTSALT"; | 507 | u.PasswordSalt = "NOTSALT"; |
397 | u.Email = "nobody@nodomain.nocc"; | ||
398 | // MUST specify at least these 5 parameters or an exception is raised | 508 | // MUST specify at least these 5 parameters or an exception is raised |
399 | 509 | ||
400 | return u; | 510 | return u; |