private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) { string capUrl; if (url == "localhost") { capUrl = "/CAPS/" + UUID.Random(); FetchInventory2Handler fetchHandler = new FetchInventory2Handler(m_inventoryService, agentID); IRequestHandler reqHandler = new RestStreamHandler( "POST", capUrl, fetchHandler.FetchInventoryRequest, capName, agentID.ToString()); caps.RegisterHandler(capName, reqHandler); } else { capUrl = url; caps.RegisterHandler(capName, capUrl); } // m_log.DebugFormat( // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); }
public void Test_002_RequestMany() { TestHelpers.InMethod(); Init(); FetchInventory2Handler handler = new FetchInventory2Handler(m_scene.InventoryService, m_userID); TestOSHttpRequest req = new TestOSHttpRequest(); TestOSHttpResponse resp = new TestOSHttpResponse(); string request = "<llsd><map><key>items</key><array>"; request += "<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000001</uuid></map>"; // Notecard 1 request += "<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000002</uuid></map>"; // Notecard 2 request += "<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000003</uuid></map>"; // Notecard 3 request += "<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000004</uuid></map>"; // Notecard 4 request += "<map><key>item_id</key><uuid>10000000-0000-0000-0000-000000000005</uuid></map>"; // Notecard 5 request += "</array></map></llsd>"; string llsdresponse = handler.FetchInventoryRequest(request, "/FETCH", string.Empty, req, resp); Assert.That(llsdresponse != null, Is.True, "Incorrect null response"); Assert.That(llsdresponse != string.Empty, Is.True, "Incorrect empty response"); Assert.That(llsdresponse.Contains(m_userID.ToString()), Is.True, "Response should contain userID"); Console.WriteLine(llsdresponse); Assert.That(llsdresponse.Contains("10000000-0000-0000-0000-000000000001"), Is.True, "Response does not contain notecard 1"); Assert.That(llsdresponse.Contains("10000000-0000-0000-0000-000000000002"), Is.True, "Response does not contain notecard 2"); Assert.That(llsdresponse.Contains("10000000-0000-0000-0000-000000000003"), Is.True, "Response does not contain notecard 3"); Assert.That(llsdresponse.Contains("10000000-0000-0000-0000-000000000004"), Is.True, "Response does not contain notecard 4"); Assert.That(llsdresponse.Contains("10000000-0000-0000-0000-000000000005"), Is.True, "Response does not contain notecard 5"); }
public void RegionLoaded(Scene s) { if (!Enabled) { return; } m_inventoryService = m_scene.InventoryService; // We'll reuse the same handler for all requests. if (m_fetchInventory2Url == "localhost") { m_fetchHandler = new FetchInventory2Handler(m_inventoryService); } m_scene.EventManager.OnRegisterCaps += RegisterCaps; }
private void RegisterCaps(UUID agentID, Caps caps) { if (m_fetchInventory2Url == "localhost") { FetchInventory2Handler fetchHandler = new FetchInventory2Handler(m_inventoryService, agentID); caps.RegisterSimpleHandler("FetchInventory2", new SimpleOSDMapHandler("POST", "/" + UUID.Random(), fetchHandler.FetchInventorySimpleRequest)); } else { caps.RegisterHandler("FetchInventory2", m_fetchInventory2Url); } // m_log.DebugFormat( // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); }