Fix bug where the uuid gatherer was not inspecting UUIDs for items in an embedded object's inventory.
Added regression test for this case.
Likely a regression since 08606ae4
(Thu Jan 8 2015)
Relates to Mantises 7439, 7450 and possibly others.
inv-download
parent
b1b72d7c2f
commit
a03d893f2c
|
@ -122,40 +122,37 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void TestTaskItem()
|
||||
public void TestTaskItems()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
TestHelpers.EnableLogging();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID ownerId = TestHelpers.ParseTail(0x10);
|
||||
UUID embeddedId = TestHelpers.ParseTail(0x20);
|
||||
UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21);
|
||||
UUID missingEmbeddedId = TestHelpers.ParseTail(0x22);
|
||||
UUID ncAssetId = TestHelpers.ParseTail(0x30);
|
||||
|
||||
AssetBase ncAsset
|
||||
= AssetHelpers.CreateNotecardAsset(
|
||||
ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId));
|
||||
m_assetService.Store(ncAsset);
|
||||
SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20);
|
||||
SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21);
|
||||
SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22);
|
||||
|
||||
AssetBase embeddedAsset
|
||||
= AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId));
|
||||
m_assetService.Store(embeddedAsset);
|
||||
TaskInventoryHelpers.AddScript(
|
||||
m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish");
|
||||
|
||||
AssetBase secondLevelEmbeddedAsset
|
||||
= AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when.");
|
||||
m_assetService.Store(secondLevelEmbeddedAsset);
|
||||
TaskInventoryHelpers.AddSceneObject(
|
||||
m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42));
|
||||
TaskInventoryHelpers.AddSceneObject(
|
||||
m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41));
|
||||
|
||||
m_uuidGatherer.AddForInspection(ncAssetId);
|
||||
m_uuidGatherer.AddForInspection(soL0);
|
||||
m_uuidGatherer.GatherAll();
|
||||
|
||||
// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
|
||||
// System.Console.WriteLine("key : {0}", key);
|
||||
// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
|
||||
// System.Console.WriteLine("key : {0}", key);
|
||||
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId));
|
||||
// We expect to see the default prim texture and the assets of the contained task items
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture)));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41)));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42)));
|
||||
Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -123,6 +123,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_assetUuidsToInspect.Contains(uuid))
|
||||
return false;
|
||||
|
||||
// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
|
||||
|
||||
m_assetUuidsToInspect.Enqueue(uuid);
|
||||
|
||||
return true;
|
||||
|
@ -238,7 +240,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (Complete)
|
||||
return false;
|
||||
|
||||
GetAssetUuids(m_assetUuidsToInspect.Dequeue());
|
||||
UUID nextToInspect = m_assetUuidsToInspect.Dequeue();
|
||||
|
||||
// m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect);
|
||||
|
||||
GetAssetUuids(nextToInspect);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -322,8 +328,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Here, we want to collect uuids which require further asset fetches but mark the others as gathered
|
||||
try
|
||||
{
|
||||
GatheredUuids[assetUuid] = assetType;
|
||||
|
||||
if ((sbyte)AssetType.Bodypart == assetType
|
||||
|| (sbyte)AssetType.Clothing == assetType
|
||||
|| (sbyte)AssetType.Gesture == assetType
|
||||
|
@ -334,11 +338,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
AddForInspection(assetUuid);
|
||||
}
|
||||
else
|
||||
{
|
||||
GatheredUuids[assetUuid] = assetType;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ITERATABLE UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
|
||||
"[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
|
||||
assetUuid, assetType);
|
||||
throw;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,37 @@ namespace OpenSim.Tests.Common
|
|||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a scene object item to the given part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
|
||||
/// functions more than once in a test.
|
||||
/// </remarks>
|
||||
///
|
||||
/// <param name="assetService"></param>
|
||||
/// <param name="sop"></param>
|
||||
/// <param name="itemName"></param>
|
||||
/// <param name="itemId"></param>
|
||||
/// <param name="soToAdd"></param>
|
||||
/// <param name="soAssetId"></param>
|
||||
public static TaskInventoryItem AddSceneObject(
|
||||
IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, SceneObjectGroup soToAdd, UUID soAssetId)
|
||||
{
|
||||
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(soAssetId, soToAdd);
|
||||
assetService.Store(taskSceneObjectAsset);
|
||||
TaskInventoryItem taskSceneObjectItem
|
||||
= new TaskInventoryItem
|
||||
{ Name = itemName,
|
||||
AssetID = taskSceneObjectAsset.FullID,
|
||||
ItemID = itemId,
|
||||
OwnerID = soToAdd.OwnerID,
|
||||
Type = (int)AssetType.Object,
|
||||
InvType = (int)InventoryType.Object };
|
||||
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
|
||||
|
||||
return taskSceneObjectItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a scene object item to the given part.
|
||||
|
@ -168,22 +199,12 @@ namespace OpenSim.Tests.Common
|
|||
/// <param name="id"></param>
|
||||
/// <param name="userId"></param>
|
||||
public static TaskInventoryItem AddSceneObject(
|
||||
IAssetService assetService, SceneObjectPart sop, string itemName, UUID id, UUID userId)
|
||||
IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, UUID userId)
|
||||
{
|
||||
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
|
||||
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
|
||||
assetService.Store(taskSceneObjectAsset);
|
||||
TaskInventoryItem taskSceneObjectItem
|
||||
= new TaskInventoryItem
|
||||
{ Name = itemName,
|
||||
AssetID = taskSceneObjectAsset.FullID,
|
||||
ItemID = id,
|
||||
OwnerID = userId,
|
||||
Type = (int)AssetType.Object,
|
||||
InvType = (int)InventoryType.Object };
|
||||
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
|
||||
SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId);
|
||||
|
||||
return taskSceneObjectItem;
|
||||
return TaskInventoryHelpers.AddSceneObject(
|
||||
assetService, sop, itemName, itemId, taskSceneObject, TestHelpers.ParseTail(0x10));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue