From 67789201c3ae40bd4697f3479eb183599baa3658 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 29 Apr 2013 22:14:13 +0100
Subject: Add TestRejectGivenFolder() and TestAcceptGivenFolder() regression
tests
---
.../Tests/Common/Helpers/UserInventoryHelpers.cs | 41 +++++++++++++++++++---
1 file changed, 37 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs')
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
public static InventoryFolderBase CreateInventoryFolder(
IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders)
{
+ return CreateInventoryFolder(inventoryService, userId, UUID.Random(), path, useExistingFolders);
+ }
+
+ ///
+ /// Create inventory folders starting from the user's root folder.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
+ ///
+ ///
+ /// If true, then folders in the path which already the same name are
+ /// used. This applies to the terminal folder as well.
+ /// If false, then all folders in the path are created, even if there is already a folder at a particular
+ /// level with the same name.
+ ///
+ ///
+ /// The folder created. If the path contains multiple folders then the last one created is returned.
+ /// Will return null if the root folder could not be found.
+ ///
+ public static InventoryFolderBase CreateInventoryFolder(
+ IInventoryService inventoryService, UUID userId, UUID folderId, string path, bool useExistingFolders)
+ {
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (null == rootFolder)
return null;
- return CreateInventoryFolder(inventoryService, rootFolder, path, useExistingFolders);
+ return CreateInventoryFolder(inventoryService, folderId, rootFolder, path, useExistingFolders);
}
///
@@ -235,6 +260,7 @@ namespace OpenSim.Tests.Common
/// TODO: May need to make it an option to create duplicate folders.
///
///
+ /// ID of the folder to create
///
///
/// The folder to create.
@@ -249,7 +275,7 @@ namespace OpenSim.Tests.Common
/// The folder created. If the path contains multiple folders then the last one created is returned.
///
public static InventoryFolderBase CreateInventoryFolder(
- IInventoryService inventoryService, InventoryFolderBase parentFolder, string path, bool useExistingFolders)
+ IInventoryService inventoryService, UUID folderId, InventoryFolderBase parentFolder, string path, bool useExistingFolders)
{
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
@@ -262,9 +288,16 @@ namespace OpenSim.Tests.Common
{
// Console.WriteLine("Creating folder {0} at {1}", components[0], parentFolder.Name);
+ UUID folderIdForCreate;
+
+ if (components.Length > 1)
+ folderIdForCreate = UUID.Random();
+ else
+ folderIdForCreate = folderId;
+
folder
= new InventoryFolderBase(
- UUID.Random(), components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
+ folderIdForCreate, components[0], parentFolder.Owner, (short)AssetType.Unknown, parentFolder.ID, 0);
inventoryService.AddFolder(folder);
}
@@ -274,7 +307,7 @@ namespace OpenSim.Tests.Common
// }
if (components.Length > 1)
- return CreateInventoryFolder(inventoryService, folder, components[1], useExistingFolders);
+ return CreateInventoryFolder(inventoryService, folderId, folder, components[1], useExistingFolders);
else
return folder;
}
--
cgit v1.1