diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 16 |
2 files changed, 32 insertions, 27 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 | |||
122 | } | 122 | } |
123 | 123 | ||
124 | [Test] | 124 | [Test] |
125 | public void TestTaskItem() | 125 | public void TestTaskItems() |
126 | { | 126 | { |
127 | TestHelpers.InMethod(); | 127 | TestHelpers.InMethod(); |
128 | TestHelpers.EnableLogging(); | 128 | // TestHelpers.EnableLogging(); |
129 | 129 | ||
130 | UUID ownerId = TestHelpers.ParseTail(0x10); | 130 | UUID ownerId = TestHelpers.ParseTail(0x10); |
131 | UUID embeddedId = TestHelpers.ParseTail(0x20); | ||
132 | UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); | ||
133 | UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); | ||
134 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | ||
135 | 131 | ||
136 | AssetBase ncAsset | 132 | SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20); |
137 | = AssetHelpers.CreateNotecardAsset( | 133 | SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21); |
138 | ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); | 134 | SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22); |
139 | m_assetService.Store(ncAsset); | ||
140 | 135 | ||
141 | AssetBase embeddedAsset | 136 | TaskInventoryHelpers.AddScript( |
142 | = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); | 137 | m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish"); |
143 | m_assetService.Store(embeddedAsset); | ||
144 | 138 | ||
145 | AssetBase secondLevelEmbeddedAsset | 139 | TaskInventoryHelpers.AddSceneObject( |
146 | = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); | 140 | m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42)); |
147 | m_assetService.Store(secondLevelEmbeddedAsset); | 141 | TaskInventoryHelpers.AddSceneObject( |
142 | m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41)); | ||
148 | 143 | ||
149 | m_uuidGatherer.AddForInspection(ncAssetId); | 144 | m_uuidGatherer.AddForInspection(soL0); |
150 | m_uuidGatherer.GatherAll(); | 145 | m_uuidGatherer.GatherAll(); |
151 | 146 | ||
152 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) | 147 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) |
153 | // System.Console.WriteLine("key : {0}", key); | 148 | // System.Console.WriteLine("key : {0}", key); |
154 | 149 | ||
155 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); | 150 | // We expect to see the default prim texture and the assets of the contained task items |
156 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); | 151 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4)); |
157 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | 152 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture))); |
158 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); | 153 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x41))); |
154 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x42))); | ||
155 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(TestHelpers.ParseTail(0x43))); | ||
159 | } | 156 | } |
160 | } | 157 | } |
161 | } \ No newline at end of file | 158 | } \ 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 | |||
123 | if (m_assetUuidsToInspect.Contains(uuid)) | 123 | if (m_assetUuidsToInspect.Contains(uuid)) |
124 | return false; | 124 | return false; |
125 | 125 | ||
126 | // m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid); | ||
127 | |||
126 | m_assetUuidsToInspect.Enqueue(uuid); | 128 | m_assetUuidsToInspect.Enqueue(uuid); |
127 | 129 | ||
128 | return true; | 130 | return true; |
@@ -238,7 +240,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | if (Complete) | 240 | if (Complete) |
239 | return false; | 241 | return false; |
240 | 242 | ||
241 | GetAssetUuids(m_assetUuidsToInspect.Dequeue()); | 243 | UUID nextToInspect = m_assetUuidsToInspect.Dequeue(); |
244 | |||
245 | // m_log.DebugFormat("[UUID GATHERER]: Inspecting asset {0}", nextToInspect); | ||
246 | |||
247 | GetAssetUuids(nextToInspect); | ||
242 | 248 | ||
243 | return true; | 249 | return true; |
244 | } | 250 | } |
@@ -322,8 +328,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
322 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered | 328 | // Here, we want to collect uuids which require further asset fetches but mark the others as gathered |
323 | try | 329 | try |
324 | { | 330 | { |
325 | GatheredUuids[assetUuid] = assetType; | ||
326 | |||
327 | if ((sbyte)AssetType.Bodypart == assetType | 331 | if ((sbyte)AssetType.Bodypart == assetType |
328 | || (sbyte)AssetType.Clothing == assetType | 332 | || (sbyte)AssetType.Clothing == assetType |
329 | || (sbyte)AssetType.Gesture == assetType | 333 | || (sbyte)AssetType.Gesture == assetType |
@@ -334,11 +338,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
334 | { | 338 | { |
335 | AddForInspection(assetUuid); | 339 | AddForInspection(assetUuid); |
336 | } | 340 | } |
341 | else | ||
342 | { | ||
343 | GatheredUuids[assetUuid] = assetType; | ||
344 | } | ||
337 | } | 345 | } |
338 | catch (Exception) | 346 | catch (Exception) |
339 | { | 347 | { |
340 | m_log.ErrorFormat( | 348 | m_log.ErrorFormat( |
341 | "[ITERATABLE UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", | 349 | "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", |
342 | assetUuid, assetType); | 350 | assetUuid, assetType); |
343 | throw; | 351 | throw; |
344 | } | 352 | } |