diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Clients/Assets/AssetsClient.cs | 126 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs | 47 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 56 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 41 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 88 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | 14 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestLandChannel.cs | 1 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 28 | ||||
-rw-r--r-- | OpenSim/Tests/Common/OpenSimTestCase.cs | 12 | ||||
-rw-r--r-- | OpenSim/Tests/Common/TestHelpers.cs | 21 |
10 files changed, 328 insertions, 106 deletions
diff --git a/OpenSim/Tests/Clients/Assets/AssetsClient.cs b/OpenSim/Tests/Clients/Assets/AssetsClient.cs new file mode 100644 index 0000000..e988d0e --- /dev/null +++ b/OpenSim/Tests/Clients/Assets/AssetsClient.cs | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | |||
35 | using OpenMetaverse; | ||
36 | using log4net; | ||
37 | using log4net.Appender; | ||
38 | using log4net.Layout; | ||
39 | |||
40 | using OpenSim.Framework; | ||
41 | using OpenSim.Services.Interfaces; | ||
42 | using OpenSim.Services.Connectors; | ||
43 | |||
44 | namespace OpenSim.Tests.Clients.AssetsClient | ||
45 | { | ||
46 | public class AssetsClient | ||
47 | { | ||
48 | private static readonly ILog m_log = | ||
49 | LogManager.GetLogger( | ||
50 | MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private static int m_MaxThreadID = 0; | ||
53 | private static readonly int NREQS = 150; | ||
54 | private static int m_NReceived = 0; | ||
55 | |||
56 | public static void Main(string[] args) | ||
57 | { | ||
58 | ConsoleAppender consoleAppender = new ConsoleAppender(); | ||
59 | consoleAppender.Layout = | ||
60 | new PatternLayout("[%thread] - %message%newline"); | ||
61 | log4net.Config.BasicConfigurator.Configure(consoleAppender); | ||
62 | |||
63 | string serverURI = "http://127.0.0.1:8003"; | ||
64 | if (args.Length > 1) | ||
65 | serverURI = args[1]; | ||
66 | int max1, max2; | ||
67 | ThreadPool.GetMaxThreads(out max1, out max2); | ||
68 | m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} max threads = {1} - {2}", serverURI, max1, max2); | ||
69 | ThreadPool.GetMinThreads(out max1, out max2); | ||
70 | m_log.InfoFormat("[ASSET CLIENT]: Connecting to {0} min threads = {1} - {2}", serverURI, max1, max2); | ||
71 | |||
72 | if (!ThreadPool.SetMinThreads(1, 1)) | ||
73 | m_log.WarnFormat("[ASSET CLIENT]: Failed to set min threads"); | ||
74 | |||
75 | if (!ThreadPool.SetMaxThreads(10, 3)) | ||
76 | m_log.WarnFormat("[ASSET CLIENT]: Failed to set max threads"); | ||
77 | |||
78 | ThreadPool.GetMaxThreads(out max1, out max2); | ||
79 | m_log.InfoFormat("[ASSET CLIENT]: Post set max threads = {1} - {2}", serverURI, max1, max2); | ||
80 | ThreadPool.GetMinThreads(out max1, out max2); | ||
81 | m_log.InfoFormat("[ASSET CLIENT]: Post set min threads = {1} - {2}", serverURI, max1, max2); | ||
82 | |||
83 | ServicePointManager.DefaultConnectionLimit = 12; | ||
84 | |||
85 | AssetServicesConnector m_Connector = new AssetServicesConnector(serverURI); | ||
86 | m_Connector.MaxAssetRequestConcurrency = 30; | ||
87 | |||
88 | for (int i = 0; i < NREQS; i++) | ||
89 | { | ||
90 | UUID uuid = UUID.Random(); | ||
91 | m_Connector.Get(uuid.ToString(), null, ResponseReceived); | ||
92 | m_log.InfoFormat("[ASSET CLIENT]: [{0}] requested asset {1}", i, uuid); | ||
93 | } | ||
94 | |||
95 | for (int i = 0; i < 500; i++) | ||
96 | { | ||
97 | var x = i; | ||
98 | ThreadPool.QueueUserWorkItem(delegate | ||
99 | { | ||
100 | Dummy(x); | ||
101 | }); | ||
102 | } | ||
103 | |||
104 | Thread.Sleep(30 * 1000); | ||
105 | m_log.InfoFormat("[ASSET CLIENT]: Received responses {0}", m_NReceived); | ||
106 | } | ||
107 | |||
108 | private static void ResponseReceived(string id, Object sender, AssetBase asset) | ||
109 | { | ||
110 | if (Thread.CurrentThread.ManagedThreadId > m_MaxThreadID) | ||
111 | m_MaxThreadID = Thread.CurrentThread.ManagedThreadId; | ||
112 | int max1, max2; | ||
113 | ThreadPool.GetAvailableThreads(out max1, out max2); | ||
114 | m_log.InfoFormat("[ASSET CLIENT]: Received asset {0} ({1}) ({2}-{3}) {4}", id, m_MaxThreadID, max1, max2, DateTime.Now.ToString("hh:mm:ss")); | ||
115 | m_NReceived++; | ||
116 | } | ||
117 | |||
118 | private static void Dummy(int i) | ||
119 | { | ||
120 | int max1, max2; | ||
121 | ThreadPool.GetAvailableThreads(out max1, out max2); | ||
122 | m_log.InfoFormat("[ASSET CLIENT]: ({0}) Hello! {1} - {2} {3}", i, max1, max2, DateTime.Now.ToString("hh:mm:ss")); | ||
123 | Thread.Sleep(2000); | ||
124 | } | ||
125 | } | ||
126 | } | ||
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs index 6cc7ff2..52a17e7 100644 --- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs | |||
@@ -31,6 +31,7 @@ using System.IO; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | 33 | using System.Text; |
34 | using System.Threading; | ||
34 | using log4net; | 35 | using log4net; |
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using NUnit.Framework; | 37 | using NUnit.Framework; |
@@ -59,7 +60,8 @@ namespace OpenSim.Tests.Common | |||
59 | /// A list that will be populated with any TestClients set up in response to | 60 | /// A list that will be populated with any TestClients set up in response to |
60 | /// being informed about a destination region. | 61 | /// being informed about a destination region. |
61 | /// </param> | 62 | /// </param> |
62 | public static void SetUpInformClientOfNeighbour(TestClient tc, List<TestClient> neighbourTcs) | 63 | public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate( |
64 | TestClient tc, List<TestClient> neighbourTcs) | ||
63 | { | 65 | { |
64 | // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the | 66 | // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the |
65 | // event queue). | 67 | // event queue). |
@@ -75,16 +77,51 @@ namespace OpenSim.Tests.Common | |||
75 | "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", | 77 | "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", |
76 | x, y, neighbourExternalEndPoint); | 78 | x, y, neighbourExternalEndPoint); |
77 | 79 | ||
78 | // In response to this message, we are going to make a teleport to the scene we've previous been told | ||
79 | // about by test code (this needs to be improved). | ||
80 | AgentCircuitData newAgent = tc.RequestClientInfo(); | 80 | AgentCircuitData newAgent = tc.RequestClientInfo(); |
81 | 81 | ||
82 | Scene neighbourScene; | 82 | Scene neighbourScene; |
83 | SceneManager.Instance.TryGetScene(x, y, out neighbourScene); | 83 | SceneManager.Instance.TryGetScene(x, y, out neighbourScene); |
84 | 84 | ||
85 | TestClient neighbourTc = new TestClient(newAgent, neighbourScene, SceneManager.Instance); | 85 | TestClient neighbourTc = new TestClient(newAgent, neighbourScene); |
86 | neighbourTcs.Add(neighbourTc); | 86 | neighbourTcs.Add(neighbourTc); |
87 | neighbourScene.AddNewClient(neighbourTc, PresenceType.User); | 87 | neighbourScene.AddNewAgent(neighbourTc, PresenceType.User); |
88 | }; | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the | ||
93 | /// viewer to setup a connection with the destination region. | ||
94 | /// </summary> | ||
95 | /// <param name='tc'></param> | ||
96 | /// <param name='neighbourTcs'> | ||
97 | /// A list that will be populated with any TestClients set up in response to | ||
98 | /// being informed about a destination region. | ||
99 | /// </param> | ||
100 | public static void SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( | ||
101 | TestClient client, List<TestClient> destinationClients) | ||
102 | { | ||
103 | client.OnTestClientSendRegionTeleport | ||
104 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => | ||
105 | { | ||
106 | uint x, y; | ||
107 | Utils.LongToUInts(regionHandle, out x, out y); | ||
108 | x /= Constants.RegionSize; | ||
109 | y /= Constants.RegionSize; | ||
110 | |||
111 | m_log.DebugFormat( | ||
112 | "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", | ||
113 | x, y, regionExternalEndPoint); | ||
114 | |||
115 | AgentCircuitData newAgent = client.RequestClientInfo(); | ||
116 | |||
117 | Scene destinationScene; | ||
118 | SceneManager.Instance.TryGetScene(x, y, out destinationScene); | ||
119 | |||
120 | TestClient destinationClient = new TestClient(newAgent, destinationScene); | ||
121 | destinationClients.Add(destinationClient); | ||
122 | destinationScene.AddNewAgent(destinationClient, PresenceType.User); | ||
123 | |||
124 | ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null); | ||
88 | }; | 125 | }; |
89 | } | 126 | } |
90 | } | 127 | } |
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index bdd9093..4cdfe98 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs | |||
@@ -447,9 +447,6 @@ namespace OpenSim.Tests.Common | |||
447 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test | 447 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test |
448 | /// </summary> | 448 | /// </summary> |
449 | /// <remarks> | 449 | /// <remarks> |
450 | /// This can be used for tests where there is only one region or where there are multiple non-neighbour regions | ||
451 | /// and teleport doesn't take place. | ||
452 | /// | ||
453 | /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will | 450 | /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will |
454 | /// make the agent circuit data (e.g. first, lastname) consistent with the user account data. | 451 | /// make the agent circuit data (e.g. first, lastname) consistent with the user account data. |
455 | /// </remarks> | 452 | /// </remarks> |
@@ -462,22 +459,6 @@ namespace OpenSim.Tests.Common | |||
462 | } | 459 | } |
463 | 460 | ||
464 | /// <summary> | 461 | /// <summary> |
465 | /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test | ||
466 | /// </summary> | ||
467 | /// <remarks> | ||
468 | /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will | ||
469 | /// make the agent circuit data (e.g. first, lastname) consistent with the user account data. | ||
470 | /// </remarks> | ||
471 | /// <param name="scene"></param> | ||
472 | /// <param name="agentId"></param> | ||
473 | /// <param name="sceneManager"></param> | ||
474 | /// <returns></returns> | ||
475 | public static ScenePresence AddScenePresence(Scene scene, UUID agentId, SceneManager sceneManager) | ||
476 | { | ||
477 | return AddScenePresence(scene, GenerateAgentData(agentId), sceneManager); | ||
478 | } | ||
479 | |||
480 | /// <summary> | ||
481 | /// Add a root agent. | 462 | /// Add a root agent. |
482 | /// </summary> | 463 | /// </summary> |
483 | /// <param name="scene"></param> | 464 | /// <param name="scene"></param> |
@@ -508,31 +489,7 @@ namespace OpenSim.Tests.Common | |||
508 | /// <returns></returns> | 489 | /// <returns></returns> |
509 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) | 490 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) |
510 | { | 491 | { |
511 | return AddScenePresence(scene, agentData, null); | 492 | return AddScenePresence(scene, new TestClient(agentData, scene), agentData); |
512 | } | ||
513 | |||
514 | /// <summary> | ||
515 | /// Add a root agent. | ||
516 | /// </summary> | ||
517 | /// <remarks> | ||
518 | /// This function | ||
519 | /// | ||
520 | /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the | ||
521 | /// userserver if grid) would give initial login data back to the client and separately tell the scene that the | ||
522 | /// agent was coming. | ||
523 | /// | ||
524 | /// 2) Connects the agent with the scene | ||
525 | /// | ||
526 | /// This function performs actions equivalent with notifying the scene that an agent is | ||
527 | /// coming and then actually connecting the agent to the scene. The one step missed out is the very first | ||
528 | /// </remarks> | ||
529 | /// <param name="scene"></param> | ||
530 | /// <param name="agentData"></param> | ||
531 | /// <param name="sceneManager"></param> | ||
532 | /// <returns></returns> | ||
533 | public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData, SceneManager sceneManager) | ||
534 | { | ||
535 | return AddScenePresence(scene, new TestClient(agentData, scene, sceneManager), agentData, sceneManager); | ||
536 | } | 493 | } |
537 | 494 | ||
538 | /// <summary> | 495 | /// <summary> |
@@ -552,10 +509,9 @@ namespace OpenSim.Tests.Common | |||
552 | /// </remarks> | 509 | /// </remarks> |
553 | /// <param name="scene"></param> | 510 | /// <param name="scene"></param> |
554 | /// <param name="agentData"></param> | 511 | /// <param name="agentData"></param> |
555 | /// <param name="sceneManager"></param> | ||
556 | /// <returns></returns> | 512 | /// <returns></returns> |
557 | public static ScenePresence AddScenePresence( | 513 | public static ScenePresence AddScenePresence( |
558 | Scene scene, IClientAPI client, AgentCircuitData agentData, SceneManager sceneManager) | 514 | Scene scene, IClientAPI client, AgentCircuitData agentData) |
559 | { | 515 | { |
560 | // We emulate the proper login sequence here by doing things in four stages | 516 | // We emulate the proper login sequence here by doing things in four stages |
561 | 517 | ||
@@ -578,10 +534,6 @@ namespace OpenSim.Tests.Common | |||
578 | /// Introduce an agent into the scene by adding a new client. | 534 | /// Introduce an agent into the scene by adding a new client. |
579 | /// </summary> | 535 | /// </summary> |
580 | /// <returns>The scene presence added</returns> | 536 | /// <returns>The scene presence added</returns> |
581 | /// <param name='sceneManager'> | ||
582 | /// Scene manager. Can be null if there is only one region in the test or multiple regions that are not | ||
583 | /// neighbours and where no teleporting takes place. | ||
584 | /// </param> | ||
585 | /// <param name='scene'></param> | 537 | /// <param name='scene'></param> |
586 | /// <param name='testClient'></param> | 538 | /// <param name='testClient'></param> |
587 | /// <param name='agentData'></param> | 539 | /// <param name='agentData'></param> |
@@ -596,7 +548,7 @@ namespace OpenSim.Tests.Common | |||
596 | Console.WriteLine("NewUserConnection failed: " + reason); | 548 | Console.WriteLine("NewUserConnection failed: " + reason); |
597 | 549 | ||
598 | // Stage 2: add the new client as a child agent to the scene | 550 | // Stage 2: add the new client as a child agent to the scene |
599 | scene.AddNewClient(client, PresenceType.User); | 551 | scene.AddNewAgent(client, PresenceType.User); |
600 | 552 | ||
601 | return scene.GetScenePresence(client.AgentId); | 553 | return scene.GetScenePresence(client.AgentId); |
602 | } | 554 | } |
@@ -607,7 +559,7 @@ namespace OpenSim.Tests.Common | |||
607 | acd.child = true; | 559 | acd.child = true; |
608 | 560 | ||
609 | // XXX: ViaLogin may not be correct for child agents | 561 | // XXX: ViaLogin may not be correct for child agents |
610 | TestClient client = new TestClient(acd, scene, null); | 562 | TestClient client = new TestClient(acd, scene); |
611 | return IntroduceClientToScene(scene, client, acd, TeleportFlags.ViaLogin); | 563 | return IntroduceClientToScene(scene, client, acd, TeleportFlags.ViaLogin); |
612 | } | 564 | } |
613 | 565 | ||
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index a1794c9..b3b75af 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -218,12 +218,37 @@ namespace OpenSim.Tests.Common | |||
218 | public static InventoryFolderBase CreateInventoryFolder( | 218 | public static InventoryFolderBase CreateInventoryFolder( |
219 | IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders) | 219 | IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders) |
220 | { | 220 | { |
221 | return CreateInventoryFolder(inventoryService, userId, UUID.Random(), path, useExistingFolders); | ||
222 | } | ||
223 | |||
224 | /// <summary> | ||
225 | /// Create inventory folders starting from the user's root folder. | ||
226 | /// </summary> | ||
227 | /// <param name="inventoryService"></param> | ||
228 | /// <param name="userId"></param> | ||
229 | /// <param name="folderId"></param> | ||
230 | /// <param name="path"> | ||
231 | /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER | ||
232 | /// </param> | ||
233 | /// <param name="useExistingFolders"> | ||
234 | /// If true, then folders in the path which already the same name are | ||
235 | /// used. This applies to the terminal folder as well. | ||
236 | /// If false, then all folders in the path are created, even if there is already a folder at a particular | ||
237 | /// level with the same name. | ||
238 | /// </param> | ||
239 | /// <returns> | ||
240 | /// The folder created. If the path contains multiple folders then the last one created is returned. | ||
241 | /// Will return null if the root folder could not be found. | ||
242 | /// </returns> | ||
243 | public static InventoryFolderBase CreateInventoryFolder( | ||
244 | IInventoryService inventoryService, UUID userId, UUID folderId, string path, bool useExistingFolders) | ||
245 | { | ||
221 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); | 246 | InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); |
222 | 247 | ||
223 | if (null == rootFolder) | 248 | if (null == rootFolder) |
224 | return null; | 249 | return null; |
225 | 250 | ||
226 | return CreateInventoryFolder(inventoryService, rootFolder, path, useExistingFolders); | 251 | return CreateInventoryFolder(inventoryService, folderId, rootFolder, path, useExistingFolders); |
227 | } | 252 | } |
228 | 253 | ||
229 | /// <summary> | 254 | /// <summary> |
@@ -235,6 +260,7 @@ namespace OpenSim.Tests.Common | |||
235 | /// TODO: May need to make it an option to create duplicate folders. | 260 | /// TODO: May need to make it an option to create duplicate folders. |
236 | /// </remarks> | 261 | /// </remarks> |
237 | /// <param name="inventoryService"></param> | 262 | /// <param name="inventoryService"></param> |
263 | /// <param name="folderId">ID of the folder to create</param> | ||
238 | /// <param name="parentFolder"></param> | 264 | /// <param name="parentFolder"></param> |
239 | /// <param name="path"> | 265 | /// <param name="path"> |
240 | /// The folder to create. | 266 | /// The folder to create. |
@@ -249,7 +275,7 @@ namespace OpenSim.Tests.Common | |||
249 | /// The folder created. If the path contains multiple folders then the last one created is returned. | 275 | /// The folder created. If the path contains multiple folders then the last one created is returned. |
250 | /// </returns> | 276 | /// </returns> |
251 | public static InventoryFolderBase CreateInventoryFolder( | 277 | public static InventoryFolderBase CreateInventoryFolder( |
252 | IInventoryService inventoryService, InventoryFolderBase parentFolder, string path, bool useExistingFolders) | 278 | IInventoryService inventoryService, UUID folderId, InventoryFolderBase parentFolder, string path, bool useExistingFolders) |
253 | { | 279 | { |
254 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); | 280 | string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); |
255 | 281 | ||
@@ -262,9 +288,16 @@ namespace OpenSim.Tests.Common | |||
262 | { | 288 | { |
263 | // Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name); | 289 | // Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name); |
264 | 290 | ||
291 | UUID folderIdForCreate; | ||
292 | |||
293 | if (components.Length > 1) | ||
294 | folderIdForCreate = UUID.Random(); | ||
295 | else | ||
296 | folderIdForCreate = folderId; | ||
297 | |||
265 | folder | 298 | folder |
266 | = new InventoryFolderBase( | 299 | = new InventoryFolderBase( |
267 | UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0); | 300 | folderIdForCreate, components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0); |
268 | 301 | ||
269 | inventoryService.AddFolder(folder); | 302 | inventoryService.AddFolder(folder); |
270 | } | 303 | } |
@@ -274,7 +307,7 @@ namespace OpenSim.Tests.Common | |||
274 | // } | 307 | // } |
275 | 308 | ||
276 | if (components.Length > 1) | 309 | if (components.Length > 1) |
277 | return CreateInventoryFolder(inventoryService, folder, components[1], useExistingFolders); | 310 | return CreateInventoryFolder(inventoryService, folderId, folder, components[1], useExistingFolders); |
278 | else | 311 | else |
279 | return folder; | 312 | return folder; |
280 | } | 313 | } |
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 | ||
diff --git a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs index 6707019..f2bae58 100644 --- a/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs +++ b/OpenSim/Tests/Common/Mock/TestEventQueueGetModule.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Framework.Servers; | 40 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Region.ClientStack.Linden; | ||
41 | using OpenSim.Region.Framework.Interfaces; | 42 | using OpenSim.Region.Framework.Interfaces; |
42 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
43 | 44 | ||
@@ -113,22 +114,25 @@ namespace OpenSim.Tests.Common | |||
113 | AddEvent(avatarID, "DisableSimulator", handle); | 114 | AddEvent(avatarID, "DisableSimulator", handle); |
114 | } | 115 | } |
115 | 116 | ||
116 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID) | 117 | public void EnableSimulator (ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY) |
117 | { | 118 | { |
118 | AddEvent(avatarID, "EnableSimulator", handle); | 119 | AddEvent(avatarID, "EnableSimulator", handle); |
119 | } | 120 | } |
120 | 121 | ||
121 | public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath) | 122 | public void EstablishAgentCommunication (UUID avatarID, IPEndPoint endPoint, string capsPath, |
123 | ulong regionHandle, int regionSizeX, int regionSizeY) | ||
122 | { | 124 | { |
123 | AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath); | 125 | AddEvent(avatarID, "EstablishAgentCommunication", endPoint, capsPath); |
124 | } | 126 | } |
125 | 127 | ||
126 | public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, uint locationID, uint flags, string capsURL, UUID agentID) | 128 | public void TeleportFinishEvent (ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, |
129 | uint locationID, uint flags, string capsURL, UUID agentID, int regionSizeX, int regionSizeY) | ||
127 | { | 130 | { |
128 | AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); | 131 | AddEvent(agentID, "TeleportFinishEvent", regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL); |
129 | } | 132 | } |
130 | 133 | ||
131 | public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, string capsURL, UUID avatarID, UUID sessionID) | 134 | public void CrossRegion (ulong handle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, |
135 | string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY) | ||
132 | { | 136 | { |
133 | AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID); | 137 | AddEvent(avatarID, "CrossRegion", handle, pos, lookAt, newRegionExternalEndPoint, capsURL, sessionID); |
134 | } | 138 | } |
@@ -164,7 +168,7 @@ namespace OpenSim.Tests.Common | |||
164 | throw new System.NotImplementedException (); | 168 | throw new System.NotImplementedException (); |
165 | } | 169 | } |
166 | 170 | ||
167 | public OSD BuildEvent (string eventName, OSD eventBody) | 171 | public OSD BuildEvent(string eventName, OSD eventBody) |
168 | { | 172 | { |
169 | Console.WriteLine("TWO"); | 173 | Console.WriteLine("TWO"); |
170 | throw new System.NotImplementedException (); | 174 | throw new System.NotImplementedException (); |
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs index 3115035..8135bfc 100644 --- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs +++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs | |||
@@ -111,5 +111,6 @@ namespace OpenSim.Tests.Common.Mock | |||
111 | 111 | ||
112 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} | 112 | public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} |
113 | public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} | 113 | public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} |
114 | public void sendClientInitialLandInfo(IClientAPI remoteClient) { } | ||
114 | } | 115 | } |
115 | } \ No newline at end of file | 116 | } \ No newline at end of file |
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 | } |
diff --git a/OpenSim/Tests/Common/OpenSimTestCase.cs b/OpenSim/Tests/Common/OpenSimTestCase.cs index 8c40923..3c47faa 100644 --- a/OpenSim/Tests/Common/OpenSimTestCase.cs +++ b/OpenSim/Tests/Common/OpenSimTestCase.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using NUnit.Framework; | 29 | using NUnit.Framework; |
30 | using OpenSim.Framework.Servers; | ||
30 | 31 | ||
31 | namespace OpenSim.Tests.Common | 32 | namespace OpenSim.Tests.Common |
32 | { | 33 | { |
@@ -40,7 +41,14 @@ namespace OpenSim.Tests.Common | |||
40 | // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests | 41 | // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests |
41 | // to have logging on if it failed with an exception. | 42 | // to have logging on if it failed with an exception. |
42 | TestHelpers.DisableLogging(); | 43 | TestHelpers.DisableLogging(); |
44 | |||
45 | // This is an unfortunate bit of clean up we have to do because MainServer manages things through static | ||
46 | // variables and the VM is not restarted between tests. | ||
47 | if (MainServer.Instance != null) | ||
48 | { | ||
49 | MainServer.RemoveHttpServer(MainServer.Instance.Port); | ||
50 | // MainServer.Instance = null; | ||
51 | } | ||
43 | } | 52 | } |
44 | } | 53 | } |
45 | } | 54 | } \ No newline at end of file |
46 | |||
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index a684d72..6bf23f8 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs | |||
@@ -117,8 +117,6 @@ namespace OpenSim.Tests.Common | |||
117 | /// Parse a UUID stem into a full UUID. | 117 | /// Parse a UUID stem into a full UUID. |
118 | /// </summary> | 118 | /// </summary> |
119 | /// <remarks> | 119 | /// <remarks> |
120 | /// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it, | ||
121 | /// UUIDs are conceptually not hexadecmial numbers. | ||
122 | /// The fragment will come at the start of the UUID. The rest will be 0s | 120 | /// The fragment will come at the start of the UUID. The rest will be 0s |
123 | /// </remarks> | 121 | /// </remarks> |
124 | /// <returns></returns> | 122 | /// <returns></returns> |
@@ -143,5 +141,24 @@ namespace OpenSim.Tests.Common | |||
143 | { | 141 | { |
144 | return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail)); | 142 | return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail)); |
145 | } | 143 | } |
144 | |||
145 | /// <summary> | ||
146 | /// Parse a UUID tail section into a full UUID. | ||
147 | /// </summary> | ||
148 | /// <remarks> | ||
149 | /// The fragment will come at the end of the UUID. The rest will be 0s | ||
150 | /// </remarks> | ||
151 | /// <returns></returns> | ||
152 | /// <param name='frag'> | ||
153 | /// A UUID fragment that will be parsed into a full UUID. Therefore, it can only contain | ||
154 | /// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is | ||
155 | /// given as the 'fragment'. | ||
156 | /// </param> | ||
157 | public static UUID ParseTail(string stem) | ||
158 | { | ||
159 | string rawUuid = stem.PadLeft(32, '0'); | ||
160 | |||
161 | return UUID.Parse(rawUuid); | ||
162 | } | ||
146 | } | 163 | } |
147 | } | 164 | } |