diff options
author | Melanie | 2013-04-30 23:45:38 +0100 |
---|---|---|
committer | Melanie | 2013-04-30 23:45:38 +0100 |
commit | b89d18e6f4a1099fe031ebf10776a752826604b9 (patch) | |
tree | b964e6b167e156dc2adeddeb733d93eac342e9c0 /OpenSim/Tests | |
parent | Merge branch 'master' into careminster (diff) | |
parent | BulletSim: fix error messages created while an avatar has no initial (diff) | |
download | opensim-SC-b89d18e6f4a1099fe031ebf10776a752826604b9.zip opensim-SC-b89d18e6f4a1099fe031ebf10776a752826604b9.tar.gz opensim-SC-b89d18e6f4a1099fe031ebf10776a752826604b9.tar.bz2 opensim-SC-b89d18e6f4a1099fe031ebf10776a752826604b9.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 41 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 16 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs | 28 |
3 files changed, 79 insertions, 6 deletions
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 07de06c..e7c1633 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -61,6 +61,7 @@ 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 Action<GridInstantMessage> OnReceivedInstantMessage; | ||
64 | 65 | ||
65 | // disable warning: public events, part of the public API | 66 | // disable warning: public events, part of the public API |
66 | #pragma warning disable 67 | 67 | #pragma warning disable 67 |
@@ -487,6 +488,18 @@ namespace OpenSim.Tests.Common.Mock | |||
487 | OnCompleteMovementToRegion(this, true); | 488 | OnCompleteMovementToRegion(this, true); |
488 | } | 489 | } |
489 | 490 | ||
491 | /// <summary> | ||
492 | /// Emulate sending an IM from the viewer to the simulator. | ||
493 | /// </summary> | ||
494 | /// <param name='im'></param> | ||
495 | public void HandleImprovedInstantMessage(GridInstantMessage im) | ||
496 | { | ||
497 | ImprovedInstantMessage handlerInstantMessage = OnInstantMessage; | ||
498 | |||
499 | if (handlerInstantMessage != null) | ||
500 | handlerInstantMessage(this, im); | ||
501 | } | ||
502 | |||
490 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) | 503 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) |
491 | { | 504 | { |
492 | } | 505 | } |
@@ -547,7 +560,8 @@ namespace OpenSim.Tests.Common.Mock | |||
547 | 560 | ||
548 | public void SendInstantMessage(GridInstantMessage im) | 561 | public void SendInstantMessage(GridInstantMessage im) |
549 | { | 562 | { |
550 | 563 | if (OnReceivedInstantMessage != null) | |
564 | OnReceivedInstantMessage(im); | ||
551 | } | 565 | } |
552 | 566 | ||
553 | public void SendGenericMessage(string method, UUID invoice, List<string> message) | 567 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |
diff --git a/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestXInventoryDataPlugin.cs index ccbdf81..30b1f38 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 | } |