aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-09 21:24:32 +0100
committerJustin Clark-Casey (justincc)2012-07-09 21:24:32 +0100
commit2eaa6d5ace738cf1848f82ce7a0b435928b6846f (patch)
tree091add9a2885fbb702cf908e1b2f70f5d1730131 /OpenSim/Tests
parentMore keys for automated ini processing (diff)
downloadopensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.zip
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.gz
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.bz2
opensim-SC_OLD-2eaa6d5ace738cf1848f82ce7a0b435928b6846f.tar.xz
Do not allow a script to attach a prim if its being sat upon.
This prevents a stack overflow where a get position on the avatar will refer to the attachment which will in turn refer back to the avatar. This required recording of all sitting avatars on a prim which is done separately from recording the sit target avatar. Recording HashSet is null if there are no sitting avatars in order to save memory.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs75
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs9
2 files changed, 67 insertions, 17 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index d5354cb..769de83 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -412,26 +412,49 @@ namespace OpenSim.Tests.Common
412 /// <returns></returns> 412 /// <returns></returns>
413 public static AgentCircuitData GenerateAgentData(UUID agentId) 413 public static AgentCircuitData GenerateAgentData(UUID agentId)
414 { 414 {
415 string firstName = "testfirstname"; 415 AgentCircuitData acd = GenerateCommonAgentData();
416 416
417 AgentCircuitData agentData = new AgentCircuitData(); 417 acd.AgentID = agentId;
418 agentData.AgentID = agentId; 418 acd.firstname = "testfirstname";
419 agentData.firstname = firstName; 419 acd.lastname = "testlastname";
420 agentData.lastname = "testlastname"; 420 acd.ServiceURLs = new Dictionary<string, object>();
421
422 return acd;
423 }
424
425 /// <summary>
426 /// Generate some standard agent connection data.
427 /// </summary>
428 /// <param name="agentId"></param>
429 /// <returns></returns>
430 public static AgentCircuitData GenerateAgentData(UserAccount ua)
431 {
432 AgentCircuitData acd = GenerateCommonAgentData();
433
434 acd.AgentID = ua.PrincipalID;
435 acd.firstname = ua.FirstName;
436 acd.lastname = ua.LastName;
437 acd.ServiceURLs = ua.ServiceURLs;
438
439 return acd;
440 }
441
442 private static AgentCircuitData GenerateCommonAgentData()
443 {
444 AgentCircuitData acd = new AgentCircuitData();
421 445
422 // XXX: Sessions must be unique, otherwise one presence can overwrite another in NullPresenceData. 446 // XXX: Sessions must be unique, otherwise one presence can overwrite another in NullPresenceData.
423 agentData.SessionID = UUID.Random(); 447 acd.SessionID = UUID.Random();
424 agentData.SecureSessionID = UUID.Random(); 448 acd.SecureSessionID = UUID.Random();
425 449
426 agentData.circuitcode = 123; 450 acd.circuitcode = 123;
427 agentData.BaseFolder = UUID.Zero; 451 acd.BaseFolder = UUID.Zero;
428 agentData.InventoryFolder = UUID.Zero; 452 acd.InventoryFolder = UUID.Zero;
429 agentData.startpos = Vector3.Zero; 453 acd.startpos = Vector3.Zero;
430 agentData.CapsPath = "http://wibble.com"; 454 acd.CapsPath = "http://wibble.com";
431 agentData.ServiceURLs = new Dictionary<string, object>(); 455 acd.Appearance = new AvatarAppearance();
432 agentData.Appearance = new AvatarAppearance(); 456
433 457 return acd;
434 return agentData;
435 } 458 }
436 459
437 /// <summary> 460 /// <summary>
@@ -440,6 +463,9 @@ namespace OpenSim.Tests.Common
440 /// <remarks> 463 /// <remarks>
441 /// This can be used for tests where there is only one region or where there are multiple non-neighbour regions 464 /// This can be used for tests where there is only one region or where there are multiple non-neighbour regions
442 /// and teleport doesn't take place. 465 /// and teleport doesn't take place.
466 ///
467 /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will
468 /// make the agent circuit data (e.g. first, lastname) consistent with the user account data.
443 /// </remarks> 469 /// </remarks>
444 /// <param name="scene"></param> 470 /// <param name="scene"></param>
445 /// <param name="agentId"></param> 471 /// <param name="agentId"></param>
@@ -452,6 +478,10 @@ namespace OpenSim.Tests.Common
452 /// <summary> 478 /// <summary>
453 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test 479 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
454 /// </summary> 480 /// </summary>
481 /// <remarks>
482 /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will
483 /// make the agent circuit data (e.g. first, lastname) consistent with the user account data.
484 /// </remarks>
455 /// <param name="scene"></param> 485 /// <param name="scene"></param>
456 /// <param name="agentId"></param> 486 /// <param name="agentId"></param>
457 /// <param name="sceneManager"></param> 487 /// <param name="sceneManager"></param>
@@ -464,6 +494,17 @@ namespace OpenSim.Tests.Common
464 /// <summary> 494 /// <summary>
465 /// Add a root agent. 495 /// Add a root agent.
466 /// </summary> 496 /// </summary>
497 /// <param name="scene"></param>
498 /// <param name="ua"></param>
499 /// <returns></returns>
500 public static ScenePresence AddScenePresence(Scene scene, UserAccount ua)
501 {
502 return AddScenePresence(scene, GenerateAgentData(ua));
503 }
504
505 /// <summary>
506 /// Add a root agent.
507 /// </summary>
467 /// <remarks> 508 /// <remarks>
468 /// This function 509 /// This function
469 /// 510 ///
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index 3d3e65c..2fbebc4 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -138,6 +138,15 @@ namespace OpenSim.Tests.Common
138 CreateUserWithInventory(scene, ua, pw); 138 CreateUserWithInventory(scene, ua, pw);
139 return ua; 139 return ua;
140 } 140 }
141
142 public static UserAccount CreateUserWithInventory(
143 Scene scene, string firstName, string lastName, int userId, string pw)
144 {
145 UserAccount ua
146 = new UserAccount(TestHelpers.ParseTail(userId)) { FirstName = firstName, LastName = lastName };
147 CreateUserWithInventory(scene, ua, pw);
148 return ua;
149 }
141 150
142 public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw) 151 public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw)
143 { 152 {