29 using System.Collections.Generic;
32 using System.Text.RegularExpressions;
35 using NUnit.Framework;
37 using OpenSim.Capabilities.Handlers;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Servers.HttpServer;
40 using OpenSim.Region.Framework.Scenes;
41 using OpenSim.Services.Interfaces;
42 using OpenSim.Tests.Common;
49 private UUID m_userID = UUID.Random();
50 private Scene m_scene;
51 private UUID m_rootFolderID;
52 private UUID m_notecardsFolder;
53 private UUID m_objectsFolder;
74 m_scene.InventoryService.CreateUserInventory(m_userID);
76 m_rootFolderID = m_scene.InventoryService.GetRootFolder(m_userID).ID;
78 InventoryFolderBase of = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Object);
79 m_objectsFolder = of.ID;
83 for (
int i = 1; i <= 3; i++)
85 item =
new InventoryItemBase(
new UUID(
"b0000000-0000-0000-0000-0000000000b" + i), m_userID);
86 item.AssetID = UUID.Random();
87 item.AssetType = (int)AssetType.Object;
88 item.
Folder = m_objectsFolder;
89 item.
Name =
"Object " + i;
90 m_scene.InventoryService.AddItem(item);
93 InventoryFolderBase ncf = m_scene.InventoryService.GetFolderForType(m_userID, FolderType.Notecard);
94 m_notecardsFolder = ncf.ID;
97 for (
int i = 1; i <= 5; i++)
99 item =
new InventoryItemBase(
new UUID(
"10000000-0000-0000-0000-00000000000" + i), m_userID);
100 item.AssetID = UUID.Random();
101 item.AssetType = (int)AssetType.Notecard;
102 item.
Folder = m_notecardsFolder;
103 item.
Name =
"Notecard " + i;
104 m_scene.InventoryService.AddItem(item);
112 TestHelpers.InMethod();
120 string request =
"<llsd><map><key>items</key><array><map><key>item_id</key><uuid>";
121 request +=
"10000000-0000-0000-0000-000000000001";
122 request +=
"</uuid></map></array></map></llsd>";
124 string llsdresponse = handler.FetchInventoryRequest(request,
"/FETCH", string.Empty, req, resp);
126 Assert.That(llsdresponse != null, Is.True,
"Incorrect null response");
127 Assert.That(llsdresponse != string.Empty, Is.True,
"Incorrect empty response");
128 Assert.That(llsdresponse.Contains(m_userID.ToString()), Is.True,
"Response should contain userID");
130 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000001"), Is.True,
"Response does not contain item uuid");
131 Assert.That(llsdresponse.Contains(
"Notecard 1"), Is.True,
"Response does not contain item Name");
132 Console.WriteLine(llsdresponse);
138 TestHelpers.InMethod();
146 string request =
"<llsd><map><key>items</key><array>";
147 request +=
"<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000001</uuid></map>";
148 request +=
"<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000002</uuid></map>";
149 request +=
"<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000003</uuid></map>";
150 request +=
"<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000004</uuid></map>";
151 request +=
"<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000005</uuid></map>";
152 request +=
"</array></map></llsd>";
154 string llsdresponse = handler.FetchInventoryRequest(request,
"/FETCH", string.Empty, req, resp);
156 Assert.That(llsdresponse != null, Is.True,
"Incorrect null response");
157 Assert.That(llsdresponse != string.Empty, Is.True,
"Incorrect empty response");
158 Assert.That(llsdresponse.Contains(m_userID.ToString()), Is.True,
"Response should contain userID");
160 Console.WriteLine(llsdresponse);
161 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000001"), Is.True,
"Response does not contain notecard 1");
162 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000002"), Is.True,
"Response does not contain notecard 2");
163 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000003"), Is.True,
"Response does not contain notecard 3");
164 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000004"), Is.True,
"Response does not contain notecard 4");
165 Assert.That(llsdresponse.Contains(
"10000000-0000-0000-0000-000000000005"), Is.True,
"Response does not contain notecard 5");
void Test_001_RequestOne()
void Test_002_RequestMany()
Inventory Item - contains all the properties associated with an individual inventory piece...
Helpers for setting up scenes.
Interactive OpenSim region server
virtual string Name
The name of the node (64 characters or less)
delegate void FetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)