Added tests that verify the absence of the bug fixed in the previous commits (cache issues).

fsassets
Diva Canto 2015-06-04 08:52:57 -07:00
parent a433a40980
commit 6f469ec0a5
2 changed files with 30 additions and 1 deletions

View File

@ -37,6 +37,8 @@ using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors; using OpenSim.Services.Connectors;
using OpenSim.Tests.Common;
namespace Robust.Tests namespace Robust.Tests
{ {
[TestFixture] [TestFixture]
@ -54,6 +56,7 @@ namespace Robust.Tests
[Test] [Test]
public void Inventory_001_CreateInventory() public void Inventory_001_CreateInventory()
{ {
TestHelpers.InMethod();
XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address); XInventoryServicesConnector m_Connector = new XInventoryServicesConnector(DemonServer.Address);
// Create an inventory that looks like this: // Create an inventory that looks like this:
@ -69,7 +72,6 @@ namespace Robust.Tests
// Link to notecard -> /Notecards/Notecard 2 // Link to notecard -> /Notecards/Notecard 2
// Link to Objects folder -> /Objects // Link to Objects folder -> /Objects
Console.WriteLine("Starting inventory test");
bool success = m_Connector.CreateUserInventory(m_userID); bool success = m_Connector.CreateUserInventory(m_userID);
Assert.IsTrue(success, "Failed to create user inventory"); 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"); 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");
}
} }
} }

View File

@ -2685,6 +2685,7 @@
<Reference name="OpenSim.Server.Handlers"/> <Reference name="OpenSim.Server.Handlers"/>
<Reference name="OpenSim.Services.Interfaces"/> <Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Services.Connectors"/> <Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="Robust"/> <Reference name="Robust"/>
<Reference name="Nini" path="../../../bin/"/> <Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/> <Reference name="log4net" path="../../../bin/"/>