diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 11 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 94 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 2 |
3 files changed, 95 insertions, 12 deletions
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 | |||
118 | 118 | ||
119 | public static UserAccount CreateUserWithInventory(Scene scene) | 119 | public static UserAccount CreateUserWithInventory(Scene scene) |
120 | { | 120 | { |
121 | return CreateUserWithInventory(scene, 99); | ||
122 | } | ||
123 | |||
124 | public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) | ||
125 | { | ||
121 | return CreateUserWithInventory( | 126 | return CreateUserWithInventory( |
122 | scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll"); | 127 | scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); |
123 | } | 128 | } |
124 | 129 | ||
125 | public static UserAccount CreateUserWithInventory( | 130 | public static UserAccount CreateUserWithInventory( |
126 | Scene scene, string firstName, string lastName, UUID userId, string pw) | 131 | Scene scene, string firstName, string lastName, UUID userId, string pw) |
127 | { | 132 | { |
128 | UserAccount ua | 133 | UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName }; |
129 | = new UserAccount(userId) | ||
130 | { FirstName = firstName, LastName = lastName }; | ||
131 | CreateUserWithInventory(scene, ua, pw); | 134 | CreateUserWithInventory(scene, ua, pw); |
132 | return ua; | 135 | return ua; |
133 | } | 136 | } |
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs index 0419134..1703597 100644 --- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | ||
31 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
32 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
33 | 35 | ||
@@ -40,18 +42,41 @@ namespace OpenSim.Tests.Common | |||
40 | { | 42 | { |
41 | public static readonly string PATH_DELIMITER = "/"; | 43 | public static readonly string PATH_DELIMITER = "/"; |
42 | 44 | ||
43 | public static InventoryItemBase CreateInventoryItem( | 45 | /// <summary> |
44 | Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) | 46 | /// Creates a notecard in the objects folder and specify an item id. |
47 | /// </summary> | ||
48 | /// <param name="scene"></param> | ||
49 | /// <param name="itemName"></param> | ||
50 | /// <param name="itemId"></param> | ||
51 | /// <param name="userId"></param> | ||
52 | /// <returns></returns> | ||
53 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID userId) | ||
45 | { | 54 | { |
55 | return CreateInventoryItem(scene, itemName, UUID.Random(), userId); | ||
56 | } | ||
57 | |||
58 | /// <summary> | ||
59 | /// Creates a notecard in the objects folder and specify an item id. | ||
60 | /// </summary> | ||
61 | /// <param name="scene"></param> | ||
62 | /// <param name="itemName"></param> | ||
63 | /// <param name="itemId"></param> | ||
64 | /// <param name="userId"></param> | ||
65 | /// <returns></returns> | ||
66 | public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) | ||
67 | { | ||
68 | AssetBase asset = AssetHelpers.CreateAsset(scene, userId); | ||
46 | InventoryItemBase item = new InventoryItemBase(); | 69 | InventoryItemBase item = new InventoryItemBase(); |
47 | item.Name = itemName; | 70 | item.Name = itemName; |
48 | item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; | 71 | item.AssetID = asset.FullID; |
49 | item.ID = itemId; | 72 | item.ID = itemId; |
73 | item.Owner = userId; | ||
74 | item.AssetType = asset.Type; | ||
75 | item.InvType = (int)InventoryType.Notecard; | ||
76 | |||
77 | InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard); | ||
50 | 78 | ||
51 | // Really quite bad since the objs folder could be moved in the future and confuse the tests | 79 | item.Folder = folder.ID; |
52 | InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); | ||
53 | |||
54 | item.Folder = objsFolder.ID; | ||
55 | scene.AddInventoryItem(item); | 80 | scene.AddInventoryItem(item); |
56 | 81 | ||
57 | return item; | 82 | return item; |
@@ -111,5 +136,60 @@ namespace OpenSim.Tests.Common | |||
111 | else | 136 | else |
112 | return newFolder; | 137 | return newFolder; |
113 | } | 138 | } |
139 | |||
140 | /// <summary> | ||
141 | /// Get the inventory folder that matches the path name. If there are multiple folders then only the first | ||
142 | /// is returned. | ||
143 | /// </summary> | ||
144 | /// <param name="inventoryService"></param> | ||
145 | /// <param name="userId"></param> | ||
146 | /// <param name="path"></param> | ||
147 | /// <returns>null if no folder matching the path was found</returns> | ||
148 | public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path) | ||
149 | { | ||
150 | List<InventoryFolderBase> folders = GetInventoryFolders(inventoryService, userId, path); | ||
151 | |||
152 | if (folders.Count != 0) | ||
153 | return folders[0]; | ||
154 | else | ||
155 | return null; | ||
156 | } | ||
157 | |||
158 | /// <summary> | ||
159 | /// Get the inventory folders that match the path name. | ||
160 | /// </summary> | ||
161 | /// <param name="inventoryService"></param> | ||
162 | /// <param name="userId"></param> | ||
163 | /// <param name="path"></param> | ||
164 | /// <returns>An empty list if no matching folders were found</returns> | ||
165 | public static List<InventoryFolderBase> GetInventoryFolders(IInventoryService inventoryService, UUID userId, string path) | ||
166 | { | ||
167 | return InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path); | ||
168 | } | ||
169 | |||
170 | /// <summary> | ||
171 | /// Get the inventory item that matches the path name. If there are multiple items then only the first | ||
172 | /// is returned. | ||
173 | /// </summary> | ||
174 | /// <param name="inventoryService"></param> | ||
175 | /// <param name="userId"></param> | ||
176 | /// <param name="path"></param> | ||
177 | /// <returns>null if no item matching the path was found</returns> | ||
178 | public static InventoryItemBase GetInventoryItem(IInventoryService inventoryService, UUID userId, string path) | ||
179 | { | ||
180 | return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path); | ||
181 | } | ||
182 | |||
183 | /// <summary> | ||
184 | /// Get the inventory items that match the path name. | ||
185 | /// </summary> | ||
186 | /// <param name="inventoryService"></param> | ||
187 | /// <param name="userId"></param> | ||
188 | /// <param name="path"></param> | ||
189 | /// <returns>An empty list if no matching items were found.</returns> | ||
190 | public static List<InventoryItemBase> GetInventoryItems(IInventoryService inventoryService, UUID userId, string path) | ||
191 | { | ||
192 | return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path); | ||
193 | } | ||
114 | } | 194 | } |
115 | } \ No newline at end of file | 195 | } \ No newline at end of file |
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 7f0eaa7..bacd773 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -637,7 +637,7 @@ namespace OpenSim.Tests.Common.Mock | |||
637 | { | 637 | { |
638 | } | 638 | } |
639 | 639 | ||
640 | public virtual void SendDialog(string objectname, UUID objectID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) | 640 | public virtual void SendDialog(string objectname, UUID objectID, UUID ownerID, string ownerFirstName, string ownerLastName, string msg, UUID textureID, int ch, string[] buttonlabels) |
641 | { | 641 | { |
642 | } | 642 | } |
643 | 643 | ||