From a03d893f2c431c220f44a6f7c1b94de7568bd6f8 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 25 Feb 2015 21:12:46 +0000
Subject: 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.
---
.../Framework/Scenes/Tests/UuidGathererTests.cs | 43 ++++++++++-----------
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 16 ++++++--
.../Tests/Common/Helpers/TaskInventoryHelpers.cs | 45 ++++++++++++++++------
3 files changed, 65 insertions(+), 39 deletions(-)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 0b41039..937c414 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -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)));
}
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index 69dc133..9ec4e1d 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -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;
}
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
index a15127e..3a3b33a 100644
--- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs
@@ -153,7 +153,6 @@ namespace OpenSim.Tests.Common
return item;
}
-
///
/// Add a scene object item to the given part.
///
@@ -165,25 +164,47 @@ namespace OpenSim.Tests.Common
///
///
///
- ///
- ///
+ ///
+ ///
+ ///
public static TaskInventoryItem AddSceneObject(
- IAssetService assetService, SceneObjectPart sop, string itemName, UUID id, UUID userId)
+ IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, SceneObjectGroup soToAdd, UUID soAssetId)
{
- SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero);
- AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
+ AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(soAssetId, soToAdd);
assetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
- { Name = itemName,
- AssetID = taskSceneObjectAsset.FullID,
- ItemID = id,
- OwnerID = userId,
- Type = (int)AssetType.Object,
- InvType = (int)InventoryType.Object };
+ { 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;
}
+
+ ///
+ /// Add a scene object item to the given part.
+ ///
+ ///
+ /// 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.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static TaskInventoryItem AddSceneObject(
+ IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, UUID userId)
+ {
+ SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId);
+
+ return TaskInventoryHelpers.AddSceneObject(
+ assetService, sop, itemName, itemId, taskSceneObject, TestHelpers.ParseTail(0x10));
+ }
}
}
\ No newline at end of file
--
cgit v1.1