mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 13:55:35 +08:00
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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user