diff options
Diffstat (limited to 'OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs index d34423d..056b4db 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/Tests/FetchInventoryDescendents2HandlerTests.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | 30 | using System.Linq; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Text.RegularExpressions; | ||
32 | using log4net; | 33 | using log4net; |
33 | using log4net.Config; | 34 | using log4net.Config; |
34 | using NUnit.Framework; | 35 | using NUnit.Framework; |
@@ -223,6 +224,44 @@ namespace OpenSim.Capabilities.Handlers.FetchInventory.Tests | |||
223 | pos2 = llsdresponse.IndexOf("Link to Objects folder"); | 224 | pos2 = llsdresponse.IndexOf("Link to Objects folder"); |
224 | Assert.Less(pos1, pos2, "Contents of source of folder link is after folder link"); | 225 | Assert.Less(pos1, pos2, "Contents of source of folder link is after folder link"); |
225 | } | 226 | } |
227 | |||
228 | [Test] | ||
229 | public void Test_004_DuplicateFolders() | ||
230 | { | ||
231 | TestHelpers.InMethod(); | ||
232 | |||
233 | FetchInvDescHandler handler = new FetchInvDescHandler(m_scene.InventoryService, null); | ||
234 | TestOSHttpRequest req = new TestOSHttpRequest(); | ||
235 | TestOSHttpResponse resp = new TestOSHttpResponse(); | ||
236 | |||
237 | string request = "<llsd><map><key>folders</key><array>"; | ||
238 | request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>"; | ||
239 | request += m_rootFolderID; | ||
240 | request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>"; | ||
241 | request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>"; | ||
242 | request += m_notecardsFolder; | ||
243 | request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>"; | ||
244 | request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>"; | ||
245 | request += m_rootFolderID; | ||
246 | request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>"; | ||
247 | request += "<map><key>fetch_folders</key><integer>1</integer><key>fetch_items</key><boolean>1</boolean><key>folder_id</key><uuid>"; | ||
248 | request += m_notecardsFolder; | ||
249 | request += "</uuid><key>owner_id</key><uuid>00000000-0000-0000-0000-000000000000</uuid><key>sort_order</key><integer>1</integer></map>"; | ||
250 | request += "</array></map></llsd>"; | ||
251 | |||
252 | string llsdresponse = handler.FetchInventoryDescendentsRequest(request, "/FETCH", string.Empty, req, resp); | ||
253 | Console.WriteLine(llsdresponse); | ||
254 | |||
255 | string root_folder = "<key>folder_id</key><uuid>" + m_rootFolderID + "</uuid>"; | ||
256 | string notecards_folder = "<key>folder_id</key><uuid>" + m_notecardsFolder + "</uuid>"; | ||
257 | |||
258 | Assert.That(llsdresponse.Contains(root_folder), "Missing root folder"); | ||
259 | Assert.That(llsdresponse.Contains(notecards_folder), "Missing notecards folder"); | ||
260 | int count = Regex.Matches(llsdresponse, root_folder).Count; | ||
261 | Assert.AreEqual(1, count, "More than 1 root folder in response"); | ||
262 | count = Regex.Matches(llsdresponse, notecards_folder).Count; | ||
263 | Assert.AreEqual(2, count, "More than 1 notecards folder in response"); // Notecards will also be under root, so 2 | ||
264 | } | ||
226 | } | 265 | } |
227 | 266 | ||
228 | } \ No newline at end of file | 267 | } \ No newline at end of file |