From 8129e64e2acea6509d5c3a80425f6aa68baa037c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 May 2011 19:25:01 +0100 Subject: Fill in the new OwnerData field in the LLUDP ScriptDialog message. If we don't do this then viewer 2.8 crashes. Resolves http://opensimulator.org/mantis/view.php?id=5510 --- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index dca5626..bf91ab5 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -637,7 +637,7 @@ namespace OpenSim.Tests.Common.Mock { } - public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) + public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) { } -- cgit v1.1 From 527e10a04e9108bebe5de76541d47409dd6ce4f4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Jun 2011 23:13:05 +0100 Subject: add stub UserInventoryTests.GiveInventoryFolder(). Not yet complete --- OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 0419134..e33145f 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -40,8 +40,15 @@ namespace OpenSim.Tests.Common { public static readonly string PATH_DELIMITER = "/"; - public static InventoryItemBase CreateInventoryItem( - Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) + /// + /// Creates a notecard in the objects folder. + /// + /// + /// + /// + /// + /// + public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) { InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; -- cgit v1.1 From 1543fd7fff3b3f3a7ce07caa3ed19846b6587df7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 00:20:54 +0100 Subject: extend TestGiveInventoryFolder() to check for the receipt by user 2 --- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index e33145f..03215f2 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -26,8 +26,10 @@ */ using System; +using System.Collections.Generic; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; @@ -118,5 +120,24 @@ namespace OpenSim.Tests.Common else return newFolder; } + + /// + /// Get the inventory folder that matches the path name. If there are multiple folders then only the first + /// is returned. + /// + /// + /// + /// + /// null if no folder matching the path was found + public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path) + { + List folders + = InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); + + if (folders.Count != 0) + return folders[0]; + else + return null; + } } } \ No newline at end of file -- cgit v1.1 From 896f039513398a46458b18ef49f52a9a3ac43659 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 00:51:49 +0100 Subject: create TestGetInventoryItem() --- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 03215f2..93b655a 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -43,7 +43,20 @@ namespace OpenSim.Tests.Common public static readonly string PATH_DELIMITER = "/"; /// - /// Creates a notecard in the objects folder. + /// Creates a notecard in the objects folder and specify an item id. + /// + /// + /// + /// + /// + /// + public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) + { + return CreateInventoryItem(scene, itemName, UUID.Random(), userId); + } + + /// + /// Creates a notecard in the objects folder and specify an item id. /// /// /// @@ -139,5 +152,18 @@ namespace OpenSim.Tests.Common else return null; } + + /// + /// Get the inventory item that matches the path name. If there are multiple items then only the first + /// is returned. + /// + /// + /// + /// + /// null if no item matching the path was found + public static InventoryItemBase GetInventoryItem(IInventoryService inventoryService, UUID userId, string path) + { + return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path); + } } } \ No newline at end of file -- cgit v1.1 From 12b1cbf8bfc559e4da40abf518e8e99fac793870 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 02:39:26 +0100 Subject: Fix give inventory tests to use different users rather than (accidentally) the same user. Extend TestGiveInventoryItem() to test giving back the same item. --- OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 11 ++++++---- .../Tests/Common/Helpers/UserInventoryHelpers.cs | 25 +++++++++++++++++----- 2 files changed, 27 insertions(+), 9 deletions(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index 8cfad79..d924ecd 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -118,16 +118,19 @@ namespace OpenSim.Tests.Common public static UserAccount CreateUserWithInventory(Scene scene) { + return CreateUserWithInventory(scene, 99); + } + + public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) + { return CreateUserWithInventory( - scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll"); + scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); } public static UserAccount CreateUserWithInventory( Scene scene, string firstName, string lastName, UUID userId, string pw) { - UserAccount ua - = new UserAccount(userId) - { FirstName = firstName, LastName = lastName }; + UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName }; CreateUserWithInventory(scene, ua, pw); return ua; } diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 93b655a..875bf4a 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -65,15 +65,18 @@ namespace OpenSim.Tests.Common /// public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) { + AssetBase asset = AssetHelpers.CreateAsset(scene, userId); InventoryItemBase item = new InventoryItemBase(); item.Name = itemName; - item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; + item.AssetID = asset.FullID; item.ID = itemId; + item.Owner = userId; + item.AssetType = asset.Type; + item.InvType = (int)InventoryType.Notecard; + + InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); - // Really quite bad since the objs folder could be moved in the future and confuse the tests - InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); - - item.Folder = objsFolder.ID; + item.Folder = folder.ID; scene.AddInventoryItem(item); return item; @@ -165,5 +168,17 @@ namespace OpenSim.Tests.Common { return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path); } + + /// + /// Get the inventory items that match the path name. + /// + /// + /// + /// + /// An empty list if no matching items were found. + public static List GetInventoryItems(IInventoryService inventoryService, UUID userId, string path) + { + return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path); + } } } \ No newline at end of file -- cgit v1.1 From fe471b64245f99a895d661a8952fc3c226ba6bfe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Jun 2011 02:44:53 +0100 Subject: Extend TestGiveInventoryFolder() to test giving back the freshly received folder --- OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 875bf4a..1703597 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs @@ -147,8 +147,7 @@ namespace OpenSim.Tests.Common /// null if no folder matching the path was found public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path) { - List folders - = InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); + List folders = GetInventoryFolders(inventoryService, userId, path); if (folders.Count != 0) return folders[0]; @@ -157,6 +156,18 @@ namespace OpenSim.Tests.Common } /// + /// Get the inventory folders that match the path name. + /// + /// + /// + /// + /// An empty list if no matching folders were found + public static List GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path) + { + return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); + } + + /// /// Get the inventory item that matches the path name. If there are multiple items then only the first /// is returned. /// -- cgit v1.1