aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/TestClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Mock/TestClient.cs')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs95
1 files changed, 61 insertions, 34 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index dce2fd7..d4f29c8 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
@@ -524,17 +544,24 @@ namespace OpenSim.Tests.Common.Mock
524 { 544 {
525 } 545 }
526 546
527 public void SetAgentThrottleSilent(int throttle, int setting) 547 public virtual void SetChildAgentThrottle(byte[] throttle, float factor)
528 { 548 {
549 }
529 550
551 public void SetAgentThrottleSilent(int throttle, int setting)
552 {
553 }
530 554
555 public int GetAgentThrottleSilent(int throttle)
556 {
557 return 0;
531 } 558 }
559
532 public byte[] GetThrottlesPacked(float multiplier) 560 public byte[] GetThrottlesPacked(float multiplier)
533 { 561 {
534 return new byte[0]; 562 return new byte[0];
535 } 563 }
536 564
537
538 public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) 565 public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)
539 { 566 {
540 } 567 }
@@ -547,7 +574,8 @@ namespace OpenSim.Tests.Common.Mock
547 574
548 public void SendInstantMessage(GridInstantMessage im) 575 public void SendInstantMessage(GridInstantMessage im)
549 { 576 {
550 577 if (OnReceivedInstantMessage != null)
578 OnReceivedInstantMessage(im);
551 } 579 }
552 580
553 public void SendGenericMessage(string method, UUID invoice, List<string> message) 581 public void SendGenericMessage(string method, UUID invoice, List<string> message)
@@ -585,7 +613,7 @@ namespace OpenSim.Tests.Common.Mock
585 { 613 {
586 AgentCircuitData agentData = new AgentCircuitData(); 614 AgentCircuitData agentData = new AgentCircuitData();
587 agentData.AgentID = AgentId; 615 agentData.AgentID = AgentId;
588 agentData.SessionID = UUID.Zero; 616 agentData.SessionID = SessionId;
589 agentData.SecureSessionID = UUID.Zero; 617 agentData.SecureSessionID = UUID.Zero;
590 agentData.circuitcode = m_circuitCode; 618 agentData.circuitcode = m_circuitCode;
591 agentData.child = false; 619 agentData.child = false;
@@ -608,21 +636,25 @@ namespace OpenSim.Tests.Common.Mock
608 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint); 636 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint);
609 } 637 }
610 638
611 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 639 public virtual void SendRegionTeleport(
612 uint locationID, uint flags, string capsURL) 640 ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
641 uint locationID, uint flags, string capsURL)
613 { 642 {
614 m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport"); 643 m_log.DebugFormat(
644 "[TEST CLIENT]: Received SendRegionTeleport for {0} {1} on {2}", m_firstName, m_lastName, m_scene.Name);
615 645
616 CapsSeedUrl = capsURL; 646 CapsSeedUrl = capsURL;
617 647
618 // We don't do this here so that the source region can complete processing first in a single-threaded 648 if (OnTestClientSendRegionTeleport != null)
619 // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport 649 OnTestClientSendRegionTeleport(
620 // CompleteTeleportClientSide(); 650 regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL);
621 } 651 }
622 652
623 public virtual void SendTeleportFailed(string reason) 653 public virtual void SendTeleportFailed(string reason)
624 { 654 {
625 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); 655 m_log.DebugFormat(
656 "[TEST CLIENT]: Teleport failed for {0} {1} on {2} with reason {3}",
657 m_firstName, m_lastName, m_scene.Name, reason);
626 } 658 }
627 659
628 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, 660 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
@@ -782,11 +814,6 @@ namespace OpenSim.Tests.Common.Mock
782 { 814 {
783 OnRegionHandShakeReply(this); 815 OnRegionHandShakeReply(this);
784 } 816 }
785
786 if (OnCompleteMovementToRegion != null)
787 {
788 OnCompleteMovementToRegion(this, true);
789 }
790 } 817 }
791 818
792 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 819 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
@@ -1260,7 +1287,7 @@ namespace OpenSim.Tests.Common.Mock
1260 { 1287 {
1261 } 1288 }
1262 1289
1263 public void StopFlying(ISceneEntity presence) 1290 public void SendAgentTerseUpdate(ISceneEntity presence)
1264 { 1291 {
1265 } 1292 }
1266 1293