From 6f469ec0a5de7633e9380eb1b370590c288cff26 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jun 2015 08:52:57 -0700 Subject: Added tests that verify the absence of the bug fixed in the previous commits (cache issues). --- .../Robust/Clients/Inventory/InventoryClient.cs | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs index 9d3f400..1dcda0b 100644 --- a/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs +++ b/OpenSim/Tests/Robust/Clients/Inventory/InventoryClient.cs @@ -37,6 +37,8 @@ using OpenSim.Framework; using OpenSim.Services.Interfaces; using OpenSim.Services.Connectors; +using OpenSim.Tests.Common; + namespace Robust.Tests { [TestFixture] @@ -54,6 +56,7 @@ namespace Robust.Tests [Test] public void Inventory_001_CreateInventory() { + TestHelpers.InMethod(); XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); // Create an inventory that looks like this: @@ -69,7 +72,6 @@ namespace Robust.Tests // Link to notecard -> /Notecards/Notecard 2 // Link to Objects folder -> /Objects - Console.WriteLine("Starting inventory test"); bool success = m_Connector.CreateUserInventory(m_userID); Assert.IsTrue(success, "Failed to create user inventory"); @@ -149,5 +151,31 @@ namespace Robust.Tests Assert.AreEqual(coll.Items.Count + coll.Folders.Count, 2, "Test Folder is expected to have exactly 2 things inside"); } + + [Test] + public void Inventory_002_DoubleItemsRequest() + { + TestHelpers.InMethod(); + XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); + + // Prefetch Notecard 1, will be cached from here on + InventoryItemBase item = new InventoryItemBase(new UUID("10000000-0000-0000-0000-000000000001"), m_userID); + item = m_Connector.GetItem(item); + Assert.NotNull(item, "Failed to get Notecard 1"); + Assert.AreEqual("Test Notecard 1", item.Name, "Wrong name for Notecard 1"); + + UUID[] uuids = new UUID[2]; + uuids[0] = item.ID; + uuids[1] = new UUID("20000000-0000-0000-0000-000000000002"); + + InventoryItemBase[] items = m_Connector.GetMultipleItems(m_userID, uuids); + Assert.NotNull(items, "Failed to get multiple items"); + Assert.IsTrue(items.Length == 2, "Requested 2 items, but didn't receive 2 items"); + + // Now they should both be cached + items = m_Connector.GetMultipleItems(m_userID, uuids); + Assert.NotNull(items, "(Repeat) Failed to get multiple items"); + Assert.IsTrue(items.Length == 2, "(Repeat) Requested 2 items, but didn't receive 2 items"); + } } } -- cgit v1.1