aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/TestClient.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs88
1 files changed, 53 insertions, 35 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index dce2fd7..2758030 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -47,9 +47,9 @@ namespace OpenSim.Tests.Common.Mock
47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); 47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
48 48
49 private Scene m_scene; 49 private Scene m_scene;
50 private SceneManager m_sceneManager;
51 50
52 // Properties so that we can get at received data for test purposes 51 // Properties so that we can get at received data for test purposes
52 public List<uint> ReceivedKills { get; private set; }
53 public List<UUID> ReceivedOfflineNotifications { get; private set; } 53 public List<UUID> ReceivedOfflineNotifications { get; private set; }
54 public List<UUID> ReceivedOnlineNotifications { get; private set; } 54 public List<UUID> ReceivedOnlineNotifications { get; private set; }
55 public List<UUID> ReceivedFriendshipTerminations { get; private set; } 55 public List<UUID> ReceivedFriendshipTerminations { get; private set; }
@@ -61,6 +61,12 @@ namespace OpenSim.Tests.Common.Mock
61 // Test client specific events - for use by tests to implement some IClientAPI behaviour. 61 // Test client specific events - for use by tests to implement some IClientAPI behaviour.
62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; 62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour; 63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64 public event TestClientOnSendRegionTeleportDelegate OnTestClientSendRegionTeleport;
65 public event Action<GridInstantMessage> OnReceivedInstantMessage;
66
67 public delegate void TestClientOnSendRegionTeleportDelegate(
68 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
69 uint locationID, uint flags, string capsURL);
64 70
65// disable warning: public events, part of the public API 71// disable warning: public events, part of the public API
66#pragma warning disable 67 72#pragma warning disable 67
@@ -106,6 +112,7 @@ namespace OpenSim.Tests.Common.Mock
106 public event Action<IClientAPI, bool> OnCompleteMovementToRegion; 112 public event Action<IClientAPI, bool> OnCompleteMovementToRegion;
107 public event UpdateAgent OnPreAgentUpdate; 113 public event UpdateAgent OnPreAgentUpdate;
108 public event UpdateAgent OnAgentUpdate; 114 public event UpdateAgent OnAgentUpdate;
115 public event UpdateAgent OnAgentCameraUpdate;
109 public event AgentRequestSit OnAgentRequestSit; 116 public event AgentRequestSit OnAgentRequestSit;
110 public event AgentSit OnAgentSit; 117 public event AgentSit OnAgentSit;
111 public event AvatarPickerRequest OnAvatarPickerRequest; 118 public event AvatarPickerRequest OnAvatarPickerRequest;
@@ -197,6 +204,7 @@ namespace OpenSim.Tests.Common.Mock
197 public event EstateCovenantRequest OnEstateCovenantRequest; 204 public event EstateCovenantRequest OnEstateCovenantRequest;
198 public event EstateChangeInfo OnEstateChangeInfo; 205 public event EstateChangeInfo OnEstateChangeInfo;
199 public event EstateManageTelehub OnEstateManageTelehub; 206 public event EstateManageTelehub OnEstateManageTelehub;
207 public event CachedTextureRequest OnCachedTextureRequest;
200 208
201 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; 209 public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
202 210
@@ -371,6 +379,8 @@ namespace OpenSim.Tests.Common.Mock
371 get { return FirstName + " " + LastName; } 379 get { return FirstName + " " + LastName; }
372 } 380 }
373 381
382 public int PingTimeMS { get { return 0; } }
383
374 public bool IsActive 384 public bool IsActive
375 { 385 {
376 get { return true; } 386 get { return true; }
@@ -435,33 +445,21 @@ namespace OpenSim.Tests.Common.Mock
435 /// <summary> 445 /// <summary>
436 /// Constructor 446 /// Constructor
437 /// </summary> 447 /// </summary>
438 /// <remarks>
439 /// Can be used for a test where there is only one region or where there are multiple regions that are not
440 /// neighbours and where no teleporting takes place. In other situations, the constructor that takes in a
441 /// scene manager should be used.
442 /// </remarks>
443 /// <param name="agentData"></param>
444 /// <param name="scene"></param>
445 public TestClient(AgentCircuitData agentData, Scene scene) : this(agentData, scene, null) {}
446
447 /// <summary>
448 /// Constructor
449 /// </summary>
450 /// <param name="agentData"></param> 448 /// <param name="agentData"></param>
451 /// <param name="scene"></param> 449 /// <param name="scene"></param>
452 /// <param name="sceneManager"></param> 450 /// <param name="sceneManager"></param>
453 public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager) 451 public TestClient(AgentCircuitData agentData, Scene scene)
454 { 452 {
455 m_agentId = agentData.AgentID; 453 m_agentId = agentData.AgentID;
456 m_firstName = agentData.firstname; 454 m_firstName = agentData.firstname;
457 m_lastName = agentData.lastname; 455 m_lastName = agentData.lastname;
458 m_circuitCode = agentData.circuitcode; 456 m_circuitCode = agentData.circuitcode;
459 m_scene = scene; 457 m_scene = scene;
460 m_sceneManager = sceneManager;
461 SessionId = agentData.SessionID; 458 SessionId = agentData.SessionID;
462 SecureSessionId = agentData.SecureSessionID; 459 SecureSessionId = agentData.SecureSessionID;
463 CapsSeedUrl = agentData.CapsPath; 460 CapsSeedUrl = agentData.CapsPath;
464 461
462 ReceivedKills = new List<uint>();
465 ReceivedOfflineNotifications = new List<UUID>(); 463 ReceivedOfflineNotifications = new List<UUID>();
466 ReceivedOnlineNotifications = new List<UUID>(); 464 ReceivedOnlineNotifications = new List<UUID>();
467 ReceivedFriendshipTerminations = new List<UUID>(); 465 ReceivedFriendshipTerminations = new List<UUID>();
@@ -484,7 +482,20 @@ namespace OpenSim.Tests.Common.Mock
484 482
485 public void CompleteMovement() 483 public void CompleteMovement()
486 { 484 {
487 OnCompleteMovementToRegion(this, true); 485 if (OnCompleteMovementToRegion != null)
486 OnCompleteMovementToRegion(this, true);
487 }
488
489 /// <summary>
490 /// Emulate sending an IM from the viewer to the simulator.
491 /// </summary>
492 /// <param name='im'></param>
493 public void HandleImprovedInstantMessage(GridInstantMessage im)
494 {
495 ImprovedInstantMessage handlerInstantMessage = OnInstantMessage;
496
497 if (handlerInstantMessage != null)
498 handlerInstantMessage(this, im);
488 } 499 }
489 500
490 public virtual void ActivateGesture(UUID assetId, UUID gestureId) 501 public virtual void ActivateGesture(UUID assetId, UUID gestureId)
@@ -499,6 +510,11 @@ namespace OpenSim.Tests.Common.Mock
499 { 510 {
500 } 511 }
501 512
513 public void SendCachedTextureResponse(ISceneEntity avatar, int serial, List<CachedTextureResponseArg> cachedTextures)
514 {
515
516 }
517
502 public virtual void Kick(string message) 518 public virtual void Kick(string message)
503 { 519 {
504 } 520 }
@@ -513,10 +529,14 @@ namespace OpenSim.Tests.Common.Mock
513 529
514 public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) 530 public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle)
515 { 531 {
532 }
516 533
534 public virtual void SendKillObject(List<uint> localID)
535 {
536 ReceivedKills.AddRange(localID);
517 } 537 }
518 538
519 public virtual void SendKillObject(ulong regionHandle, List<uint> localID) 539 public void SendPartFullUpdate(ISceneEntity ent, uint? parentID)
520 { 540 {
521 } 541 }
522 542
@@ -526,15 +546,13 @@ namespace OpenSim.Tests.Common.Mock
526 546
527 public void SetAgentThrottleSilent(int throttle, int setting) 547 public void SetAgentThrottleSilent(int throttle, int setting)
528 { 548 {
529
530
531 } 549 }
550
532 public byte[] GetThrottlesPacked(float multiplier) 551 public byte[] GetThrottlesPacked(float multiplier)
533 { 552 {
534 return new byte[0]; 553 return new byte[0];
535 } 554 }
536 555
537
538 public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) 556 public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
539 { 557 {
540 } 558 }
@@ -547,7 +565,8 @@ namespace OpenSim.Tests.Common.Mock
547 565
548 public void SendInstantMessage(GridInstantMessage im) 566 public void SendInstantMessage(GridInstantMessage im)
549 { 567 {
550 568 if (OnReceivedInstantMessage != null)
569 OnReceivedInstantMessage(im);
551 } 570 }
552 571
553 public void SendGenericMessage(string method, UUID invoice, List<string> message) 572 public void SendGenericMessage(string method, UUID invoice, List<string> message)
@@ -585,7 +604,7 @@ namespace OpenSim.Tests.Common.Mock
585 { 604 {
586 AgentCircuitData agentData = new AgentCircuitData(); 605 AgentCircuitData agentData = new AgentCircuitData();
587 agentData.AgentID = AgentId; 606 agentData.AgentID = AgentId;
588 agentData.SessionID = UUID.Zero; 607 agentData.SessionID = SessionId;
589 agentData.SecureSessionID = UUID.Zero; 608 agentData.SecureSessionID = UUID.Zero;
590 agentData.circuitcode = m_circuitCode; 609 agentData.circuitcode = m_circuitCode;
591 agentData.child = false; 610 agentData.child = false;
@@ -608,21 +627,25 @@ namespace OpenSim.Tests.Common.Mock
608 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint); 627 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint);
609 } 628 }
610 629
611 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 630 public virtual void SendRegionTeleport(
612 uint locationID, uint flags, string capsURL) 631 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
632 uint locationID, uint flags, string capsURL)
613 { 633 {
614 m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport"); 634 m_log.DebugFormat(
635 "[TEST CLIENT]: Received SendRegionTeleport for {0} {1} on {2}", m_firstName, m_lastName, m_scene.Name);
615 636
616 CapsSeedUrl = capsURL; 637 CapsSeedUrl = capsURL;
617 638
618 // We don't do this here so that the source region can complete processing first in a single-threaded 639 if (OnTestClientSendRegionTeleport != null)
619 // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport 640 OnTestClientSendRegionTeleport(
620 // CompleteTeleportClientSide(); 641 regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL);
621 } 642 }
622 643
623 public virtual void SendTeleportFailed(string reason) 644 public virtual void SendTeleportFailed(string reason)
624 { 645 {
625 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); 646 m_log.DebugFormat(
647 "[TEST CLIENT]: Teleport failed for {0} {1} on {2} with reason {3}",
648 m_firstName, m_lastName, m_scene.Name, reason);
626 } 649 }
627 650
628 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, 651 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
@@ -782,11 +805,6 @@ namespace OpenSim.Tests.Common.Mock
782 { 805 {
783 OnRegionHandShakeReply(this); 806 OnRegionHandShakeReply(this);
784 } 807 }
785
786 if (OnCompleteMovementToRegion != null)
787 {
788 OnCompleteMovementToRegion(this, true);
789 }
790 } 808 }
791 809
792 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 810 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
@@ -1260,7 +1278,7 @@ namespace OpenSim.Tests.Common.Mock
1260 { 1278 {
1261 } 1279 }
1262 1280
1263 public void StopFlying(ISceneEntity presence) 1281 public void SendAgentTerseUpdate(ISceneEntity presence)
1264 { 1282 {
1265 } 1283 }
1266 1284