diff options
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 79 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 28 |
2 files changed, 75 insertions, 32 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index dce2fd7..e8520f2 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 | ||
@@ -435,33 +443,21 @@ namespace OpenSim.Tests.Common.Mock | |||
435 | /// <summary> | 443 | /// <summary> |
436 | /// Constructor | 444 | /// Constructor |
437 | /// </summary> | 445 | /// </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> | 446 | /// <param name="agentData"></param> |
451 | /// <param name="scene"></param> | 447 | /// <param name="scene"></param> |
452 | /// <param name="sceneManager"></param> | 448 | /// <param name="sceneManager"></param> |
453 | public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager) | 449 | public TestClient(AgentCircuitData agentData, Scene scene) |
454 | { | 450 | { |
455 | m_agentId = agentData.AgentID; | 451 | m_agentId = agentData.AgentID; |
456 | m_firstName = agentData.firstname; | 452 | m_firstName = agentData.firstname; |
457 | m_lastName = agentData.lastname; | 453 | m_lastName = agentData.lastname; |
458 | m_circuitCode = agentData.circuitcode; | 454 | m_circuitCode = agentData.circuitcode; |
459 | m_scene = scene; | 455 | m_scene = scene; |
460 | m_sceneManager = sceneManager; | ||
461 | SessionId = agentData.SessionID; | 456 | SessionId = agentData.SessionID; |
462 | SecureSessionId = agentData.SecureSessionID; | 457 | SecureSessionId = agentData.SecureSessionID; |
463 | CapsSeedUrl = agentData.CapsPath; | 458 | CapsSeedUrl = agentData.CapsPath; |
464 | 459 | ||
460 | ReceivedKills = new List<uint>(); | ||
465 | ReceivedOfflineNotifications = new List<UUID>(); | 461 | ReceivedOfflineNotifications = new List<UUID>(); |
466 | ReceivedOnlineNotifications = new List<UUID>(); | 462 | ReceivedOnlineNotifications = new List<UUID>(); |
467 | ReceivedFriendshipTerminations = new List<UUID>(); | 463 | ReceivedFriendshipTerminations = new List<UUID>(); |
@@ -484,7 +480,20 @@ namespace OpenSim.Tests.Common.Mock | |||
484 | 480 | ||
485 | public void CompleteMovement() | 481 | public void CompleteMovement() |
486 | { | 482 | { |
487 | OnCompleteMovementToRegion(this, true); | 483 | if (OnCompleteMovementToRegion != null) |
484 | OnCompleteMovementToRegion(this, true); | ||
485 | } | ||
486 | |||
487 | /// <summary> | ||
488 | /// Emulate sending an IM from the viewer to the simulator. | ||
489 | /// </summary> | ||
490 | /// <param name='im'></param> | ||
491 | public void HandleImprovedInstantMessage(GridInstantMessage im) | ||
492 | { | ||
493 | ImprovedInstantMessage handlerInstantMessage = OnInstantMessage; | ||
494 | |||
495 | if (handlerInstantMessage != null) | ||
496 | handlerInstantMessage(this, im); | ||
488 | } | 497 | } |
489 | 498 | ||
490 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) | 499 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) |
@@ -499,6 +508,11 @@ namespace OpenSim.Tests.Common.Mock | |||
499 | { | 508 | { |
500 | } | 509 | } |
501 | 510 | ||
511 | public void SendCachedTextureResponse(ISceneEntity avatar, int serial, List<CachedTextureResponseArg> cachedTextures) | ||
512 | { | ||
513 | |||
514 | } | ||
515 | |||
502 | public virtual void Kick(string message) | 516 | public virtual void Kick(string message) |
503 | { | 517 | { |
504 | } | 518 | } |
@@ -513,11 +527,11 @@ namespace OpenSim.Tests.Common.Mock | |||
513 | 527 | ||
514 | public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) | 528 | public virtual void SendAgentDataUpdate(UUID agentid, UUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) |
515 | { | 529 | { |
516 | |||
517 | } | 530 | } |
518 | 531 | ||
519 | public virtual void SendKillObject(ulong regionHandle, List<uint> localID) | 532 | public virtual void SendKillObject(List<uint> localID) |
520 | { | 533 | { |
534 | ReceivedKills.AddRange(localID); | ||
521 | } | 535 | } |
522 | 536 | ||
523 | public virtual void SetChildAgentThrottle(byte[] throttle) | 537 | public virtual void SetChildAgentThrottle(byte[] throttle) |
@@ -526,15 +540,13 @@ namespace OpenSim.Tests.Common.Mock | |||
526 | 540 | ||
527 | public void SetAgentThrottleSilent(int throttle, int setting) | 541 | public void SetAgentThrottleSilent(int throttle, int setting) |
528 | { | 542 | { |
529 | |||
530 | |||
531 | } | 543 | } |
544 | |||
532 | public byte[] GetThrottlesPacked(float multiplier) | 545 | public byte[] GetThrottlesPacked(float multiplier) |
533 | { | 546 | { |
534 | return new byte[0]; | 547 | return new byte[0]; |
535 | } | 548 | } |
536 | 549 | ||
537 | |||
538 | public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) | 550 | public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs) |
539 | { | 551 | { |
540 | } | 552 | } |
@@ -547,7 +559,8 @@ namespace OpenSim.Tests.Common.Mock | |||
547 | 559 | ||
548 | public void SendInstantMessage(GridInstantMessage im) | 560 | public void SendInstantMessage(GridInstantMessage im) |
549 | { | 561 | { |
550 | 562 | if (OnReceivedInstantMessage != null) | |
563 | OnReceivedInstantMessage(im); | ||
551 | } | 564 | } |
552 | 565 | ||
553 | public void SendGenericMessage(string method, UUID invoice, List<string> message) | 566 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |
@@ -585,7 +598,7 @@ namespace OpenSim.Tests.Common.Mock | |||
585 | { | 598 | { |
586 | AgentCircuitData agentData = new AgentCircuitData(); | 599 | AgentCircuitData agentData = new AgentCircuitData(); |
587 | agentData.AgentID = AgentId; | 600 | agentData.AgentID = AgentId; |
588 | agentData.SessionID = UUID.Zero; | 601 | agentData.SessionID = SessionId; |
589 | agentData.SecureSessionID = UUID.Zero; | 602 | agentData.SecureSessionID = UUID.Zero; |
590 | agentData.circuitcode = m_circuitCode; | 603 | agentData.circuitcode = m_circuitCode; |
591 | agentData.child = false; | 604 | agentData.child = false; |
@@ -608,21 +621,25 @@ namespace OpenSim.Tests.Common.Mock | |||
608 | OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint); | 621 | OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint); |
609 | } | 622 | } |
610 | 623 | ||
611 | public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, | 624 | public virtual void SendRegionTeleport( |
612 | uint locationID, uint flags, string capsURL) | 625 | ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
626 | uint locationID, uint flags, string capsURL) | ||
613 | { | 627 | { |
614 | m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport"); | 628 | m_log.DebugFormat( |
629 | "[TEST CLIENT]: Received SendRegionTeleport for {0} {1} on {2}", m_firstName, m_lastName, m_scene.Name); | ||
615 | 630 | ||
616 | CapsSeedUrl = capsURL; | 631 | CapsSeedUrl = capsURL; |
617 | 632 | ||
618 | // We don't do this here so that the source region can complete processing first in a single-threaded | 633 | if (OnTestClientSendRegionTeleport != null) |
619 | // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport | 634 | OnTestClientSendRegionTeleport( |
620 | // CompleteTeleportClientSide(); | 635 | regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); |
621 | } | 636 | } |
622 | 637 | ||
623 | public virtual void SendTeleportFailed(string reason) | 638 | public virtual void SendTeleportFailed(string reason) |
624 | { | 639 | { |
625 | m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); | 640 | m_log.DebugFormat( |
641 | "[TEST CLIENT]: Teleport failed for {0} {1} on {2} with reason {3}", | ||
642 | m_firstName, m_lastName, m_scene.Name, reason); | ||
626 | } | 643 | } |
627 | 644 | ||
628 | public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, | 645 | public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, |
@@ -1260,7 +1277,7 @@ namespace OpenSim.Tests.Common.Mock | |||
1260 | { | 1277 | { |
1261 | } | 1278 | } |
1262 | 1279 | ||
1263 | public void StopFlying(ISceneEntity presence) | 1280 | public void SendAgentTerseUpdate(ISceneEntity presence) |
1264 | { | 1281 | { |
1265 | } | 1282 | } |
1266 | 1283 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs index ccbdf81..2be5524 100644 --- a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | |||
@@ -53,6 +53,9 @@ namespace OpenSim.Tests.Common.Mock | |||
53 | 53 | ||
54 | public XInventoryFolder[] GetFolders(string[] fields, string[] vals) | 54 | public XInventoryFolder[] GetFolders(string[] fields, string[] vals) |
55 | { | 55 | { |
56 | // Console.WriteLine( | ||
57 | // "Requesting folders, fields {0}, vals {1}", string.Join(",", fields), string.Join(",", vals)); | ||
58 | |||
56 | List<XInventoryFolder> origFolders | 59 | List<XInventoryFolder> origFolders |
57 | = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); | 60 | = Get<XInventoryFolder>(fields, vals, m_allFolders.Values.ToList()); |
58 | 61 | ||
@@ -104,7 +107,30 @@ namespace OpenSim.Tests.Common.Mock | |||
104 | } | 107 | } |
105 | 108 | ||
106 | public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); } | 109 | public bool MoveItem(string id, string newParent) { throw new NotImplementedException(); } |
107 | public bool MoveFolder(string id, string newParent) { throw new NotImplementedException(); } | 110 | |
111 | public bool MoveFolder(string id, string newParent) | ||
112 | { | ||
113 | // Don't use GetFolders() here - it takes a clone! | ||
114 | XInventoryFolder folder = m_allFolders[new UUID(id)]; | ||
115 | |||
116 | if (folder == null) | ||
117 | return false; | ||
118 | |||
119 | folder.parentFolderID = new UUID(newParent); | ||
120 | |||
121 | // XInventoryFolder[] newParentFolders | ||
122 | // = GetFolders(new string[] { "folderID" }, new string[] { folder.parentFolderID.ToString() }); | ||
123 | |||
124 | // Console.WriteLine( | ||
125 | // "Moved folder {0} {1}, to {2} {3}", | ||
126 | // folder.folderName, folder.folderID, newParentFolders[0].folderName, folder.parentFolderID); | ||
127 | |||
128 | // TODO: Really need to implement folder version incrementing, though this should be common code anyway, | ||
129 | // not reimplemented in each db plugin. | ||
130 | |||
131 | return true; | ||
132 | } | ||
133 | |||
108 | public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); } | 134 | public XInventoryItem[] GetActiveGestures(UUID principalID) { throw new NotImplementedException(); } |
109 | public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); } | 135 | public int GetAssetPermissions(UUID principalID, UUID assetID) { throw new NotImplementedException(); } |
110 | } | 136 | } |