aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorSean Dague2008-11-04 18:53:13 +0000
committerSean Dague2008-11-04 18:53:13 +0000
commit972143b592b6aa5ad4f9f9d4662d7d143d1996d3 (patch)
treea20823d2c923e7c0f24f26866b3752e69918502a /OpenSim/Data
parent- Stronger inventory tests (diff)
downloadopensim-SC_OLD-972143b592b6aa5ad4f9f9d4662d7d143d1996d3.zip
opensim-SC_OLD-972143b592b6aa5ad4f9f9d4662d7d143d1996d3.tar.gz
opensim-SC_OLD-972143b592b6aa5ad4f9f9d4662d7d143d1996d3.tar.bz2
opensim-SC_OLD-972143b592b6aa5ad4f9f9d4662d7d143d1996d3.tar.xz
- Added stronger persistence tests for BasicUserTests
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs4
-rw-r--r--OpenSim/Data/Tests/BasicUserTest.cs112
2 files changed, 103 insertions, 13 deletions
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index a259427..12435c9 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -206,7 +206,7 @@ namespace OpenSim.Data.Tests
206 } 206 }
207 207
208 [Test] 208 [Test]
209 public void T013_DatabaseConsistency() 209 public void T013_DatabasePersistency()
210 { 210 {
211 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data 211 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
212 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored 212 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
@@ -587,7 +587,7 @@ namespace OpenSim.Data.Tests
587 Assert.That(t.Flags,Is.EqualTo(flags)); 587 Assert.That(t.Flags,Is.EqualTo(flags));
588 Assert.That(t.GroupID,Is.EqualTo(sog.RootPart.GroupID)); 588 Assert.That(t.GroupID,Is.EqualTo(sog.RootPart.GroupID));
589 // Where is this group permissions?? 589 // Where is this group permissions??
590 //Assert.That(t.GroupPermissions,Is.EqualTo()); 590 // Assert.That(t.GroupPermissions,Is.EqualTo());
591 Assert.That(t.InvType,Is.EqualTo(invtype)); 591 Assert.That(t.InvType,Is.EqualTo(invtype));
592 Assert.That(t.ItemID,Is.EqualTo(id)); 592 Assert.That(t.ItemID,Is.EqualTo(id));
593 Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID)); 593 Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID));
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 5e6e4da..ba4ce70 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Data.Tests
48 public UUID user4; 48 public UUID user4;
49 public UUID webkey; 49 public UUID webkey;
50 public UUID zero = UUID.Zero; 50 public UUID zero = UUID.Zero;
51 public Random random; 51 public static Random random;
52 52
53 public UUID agent1; 53 public UUID agent1;
54 public UUID agent2; 54 public UUID agent2;
@@ -87,14 +87,14 @@ namespace OpenSim.Data.Tests
87 agent4 = UUID.Random(); 87 agent4 = UUID.Random();
88 webkey = UUID.Random(); 88 webkey = UUID.Random();
89 region1 = UUID.Random(); 89 region1 = UUID.Random();
90 fname0 = RandomName(random); 90 fname0 = RandomName();
91 lname0 = RandomName(random); 91 lname0 = RandomName();
92 fname1 = RandomName(random); 92 fname1 = RandomName();
93 lname1 = RandomName(random); 93 lname1 = RandomName();
94 fname2 = RandomName(random); 94 fname2 = RandomName();
95 lname2 = RandomName(random); 95 lname2 = RandomName();
96 fname3 = RandomName(random); 96 fname3 = RandomName();
97 lname3 = RandomName(random); 97 lname3 = RandomName();
98 } 98 }
99 99
100 [Test] 100 [Test]
@@ -182,6 +182,96 @@ namespace OpenSim.Data.Tests
182 Assert.That(db.GetUserByUUID(zero),Is.Null); 182 Assert.That(db.GetUserByUUID(zero),Is.Null);
183 Assert.That(db.GetUserByUUID(user4),Is.Null); 183 Assert.That(db.GetUserByUUID(user4),Is.Null);
184 } 184 }
185
186 [Test]
187 public void T015_UserPersistency()
188 {
189 UserProfileData u = new UserProfileData();
190 UUID id = UUID.Random();
191 string fname = RandomName();
192 string lname = RandomName();
193 string passhash = RandomName();
194 string passsalt = RandomName();
195 UUID homeregion = UUID.Random();
196 UUID webloginkey = UUID.Random();
197 uint homeregx = (uint) random.Next();
198 uint homeregy = (uint) random.Next();
199 Vector3 homeloc = new Vector3((float) random.NextDouble(),(float) random.NextDouble(),(float) random.NextDouble());
200 Vector3 homelookat = new Vector3((float)random.NextDouble(),(float)random.NextDouble(),(float)random.NextDouble());
201 int created = random.Next();
202 int lastlogin = random.Next();
203 UUID rootinvfolder = UUID.Random();
204 string userinvuri = RandomName();
205 string userasseturi = RandomName();
206 uint candomask = (uint) random.Next();
207 uint wantdomask = (uint) random.Next();
208 string abouttext = RandomName();
209 string flabouttext = RandomName();
210 UUID image = UUID.Random();
211 UUID firstimage = UUID.Random();
212 UserAgentData agent = NewAgent(id,UUID.Random());
213 int userflags = random.Next();
214 int godlevel = random.Next();
215 string customtype = RandomName();
216 UUID partner = UUID.Random();
217
218 u.ID = id;
219 u.WebLoginKey = webloginkey;
220 u.HomeRegionID = homeregion;
221 u.FirstName = fname;
222 u.SurName = lname;
223 u.PasswordHash = passhash;
224 u.PasswordSalt = passsalt;
225 u.HomeRegionX = homeregx;
226 u.HomeRegionY = homeregy;
227 u.HomeLocation = homeloc;
228 u.HomeLookAt = homelookat;
229 u.Created = created;
230 u.LastLogin = lastlogin;
231 u.RootInventoryFolderID = rootinvfolder;
232 u.UserInventoryURI = userinvuri;
233 u.UserAssetURI = userasseturi;
234 u.CanDoMask = candomask;
235 u.WantDoMask = wantdomask;
236 u.AboutText = abouttext;
237 u.FirstLifeAboutText = flabouttext;
238 u.Image = image;
239 u.FirstLifeImage = firstimage;
240 u.CurrentAgent = agent;
241 u.UserFlags = userflags;
242 u.GodLevel = godlevel;
243 u.CustomType = customtype;
244 u.Partner = partner;
245
246 db.AddNewUserProfile(u);
247 UserProfileData u1a = db.GetUserByUUID(id);
248 Assert.That(u1a,Is.Not.Null);
249 Assert.That(homeregion,Is.EqualTo(u.HomeRegionID));
250 Assert.That(webloginkey,Is.EqualTo(u.WebLoginKey));
251 Assert.That(fname,Is.EqualTo(u.FirstName));
252 Assert.That(lname,Is.EqualTo(u.SurName));
253 Assert.That(passhash,Is.EqualTo(u.PasswordHash));
254 Assert.That(passsalt,Is.EqualTo(u.PasswordSalt));
255 Assert.That(homeregx,Is.EqualTo(u.HomeRegionX));
256 Assert.That(homeregy,Is.EqualTo(u.HomeRegionY));
257 Assert.That(homeloc,Is.EqualTo(u.HomeLocation));
258 Assert.That(homelookat,Is.EqualTo(u.HomeLookAt));
259 Assert.That(created,Is.EqualTo(u.Created));
260 Assert.That(lastlogin,Is.EqualTo(u.LastLogin));
261 Assert.That(rootinvfolder,Is.EqualTo(u.RootInventoryFolderID));
262 Assert.That(userinvuri,Is.EqualTo(u.UserInventoryURI));
263 Assert.That(userasseturi,Is.EqualTo(u.UserAssetURI));
264 Assert.That(candomask,Is.EqualTo(u.CanDoMask));
265 Assert.That(abouttext,Is.EqualTo(u.AboutText));
266 Assert.That(flabouttext,Is.EqualTo(u.FirstLifeAboutText));
267 Assert.That(image,Is.EqualTo(u.Image));
268 Assert.That(firstimage,Is.EqualTo(u.FirstLifeImage));
269 Assert.That(agent,Is.EqualTo(u.CurrentAgent));
270 Assert.That(userflags,Is.EqualTo(u.UserFlags));
271 Assert.That(godlevel,Is.EqualTo(u.GodLevel));
272 Assert.That(customtype,Is.EqualTo(u.CustomType));
273 Assert.That(partner,Is.EqualTo(u.Partner));
274 }
185 275
186 [Test] 276 [Test]
187 public void T020_CreateAgent() 277 public void T020_CreateAgent()
@@ -312,11 +402,11 @@ namespace OpenSim.Data.Tests
312 a.ProfileID = user_profile; 402 a.ProfileID = user_profile;
313 a.SessionID = agent; 403 a.SessionID = agent;
314 a.SecureSessionID = UUID.Random(); 404 a.SecureSessionID = UUID.Random();
315 a.AgentIP = RandomName(random); 405 a.AgentIP = RandomName();
316 return a; 406 return a;
317 } 407 }
318 408
319 public static string RandomName(Random random) 409 public static string RandomName()
320 { 410 {
321 StringBuilder name = new StringBuilder(); 411 StringBuilder name = new StringBuilder();
322 int size = random.Next(5,12); 412 int size = random.Next(5,12);