aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs98
-rw-r--r--OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs9
2 files changed, 87 insertions, 20 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index 3a2e420..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 ///
@@ -601,19 +642,36 @@ namespace OpenSim.Tests.Common
601 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 642 ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
602 { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) }; 643 { Name = name, UUID = id, Scale = new Vector3(1, 1, 1) };
603 } 644 }
604 645
605 /// <summary> 646 /// <summary>
606 /// Create a scene object but do not add it to the scene. 647 /// Create a scene object but do not add it to the scene.
607 /// </summary> 648 /// </summary>
608 /// <remarks> 649 /// <remarks>
609 /// UUID always starts at 00000000-0000-0000-0000-000000000001 650 /// UUID always starts at 00000000-0000-0000-0000-000000000001. For some purposes, (e.g. serializing direct
651 /// to another object's inventory) we do not need a scene unique ID. So it would be better to add the
652 /// UUID when we actually add an object to a scene rather than on creation.
610 /// </remarks> 653 /// </remarks>
611 /// <param name="parts">The number of parts that should be in the scene object</param> 654 /// <param name="parts">The number of parts that should be in the scene object</param>
612 /// <param name="ownerId"></param> 655 /// <param name="ownerId"></param>
613 /// <returns></returns> 656 /// <returns></returns>
614 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId) 657 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
615 { 658 {
616 return CreateSceneObject(parts, ownerId, "", 0x1); 659 return CreateSceneObject(parts, ownerId, 0x1);
660 }
661
662 /// <summary>
663 /// Create a scene object but do not add it to the scene.
664 /// </summary>
665 /// <param name="parts">The number of parts that should be in the scene object</param>
666 /// <param name="ownerId"></param>
667 /// <param name="uuidTail">
668 /// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
669 /// will be given to the root part, and incremented for each part thereafter.
670 /// </param>
671 /// <returns></returns>
672 public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
673 {
674 return CreateSceneObject(parts, ownerId, "", uuidTail);
617 } 675 }
618 676
619 /// <summary> 677 /// <summary>
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 {