diff options
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 43 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 16 | ||||
-rw-r--r-- | OpenSim/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 | |||
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 | } |
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 | |||
153 | return item; | 153 | return item; |
154 | } | 154 | } |
155 | 155 | ||
156 | |||
157 | /// <summary> | 156 | /// <summary> |
158 | /// Add a scene object item to the given part. | 157 | /// Add a scene object item to the given part. |
159 | /// </summary> | 158 | /// </summary> |
@@ -165,25 +164,47 @@ namespace OpenSim.Tests.Common | |||
165 | /// <param name="assetService"></param> | 164 | /// <param name="assetService"></param> |
166 | /// <param name="sop"></param> | 165 | /// <param name="sop"></param> |
167 | /// <param name="itemName"></param> | 166 | /// <param name="itemName"></param> |
168 | /// <param name="id"></param> | 167 | /// <param name="itemId"></param> |
169 | /// <param name="userId"></param> | 168 | /// <param name="soToAdd"></param> |
169 | /// <param name="soAssetId"></param> | ||
170 | public static TaskInventoryItem AddSceneObject( | 170 | public static TaskInventoryItem AddSceneObject( |
171 | IAssetService assetService, SceneObjectPart sop, string itemName, UUID id, UUID userId) | 171 | IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, SceneObjectGroup soToAdd, UUID soAssetId) |
172 | { | 172 | { |
173 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, UUID.Zero); | 173 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(soAssetId, soToAdd); |
174 | AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject); | ||
175 | assetService.Store(taskSceneObjectAsset); | 174 | assetService.Store(taskSceneObjectAsset); |
176 | TaskInventoryItem taskSceneObjectItem | 175 | TaskInventoryItem taskSceneObjectItem |
177 | = new TaskInventoryItem | 176 | = new TaskInventoryItem |
178 | { Name = itemName, | 177 | { Name = itemName, |
179 | AssetID = taskSceneObjectAsset.FullID, | 178 | AssetID = taskSceneObjectAsset.FullID, |
180 | ItemID = id, | 179 | ItemID = itemId, |
181 | OwnerID = userId, | 180 | OwnerID = soToAdd.OwnerID, |
182 | Type = (int)AssetType.Object, | 181 | Type = (int)AssetType.Object, |
183 | InvType = (int)InventoryType.Object }; | 182 | InvType = (int)InventoryType.Object }; |
184 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); | 183 | sop.Inventory.AddInventoryItem(taskSceneObjectItem, true); |
185 | 184 | ||
186 | return taskSceneObjectItem; | 185 | return taskSceneObjectItem; |
187 | } | 186 | } |
187 | |||
188 | /// <summary> | ||
189 | /// Add a scene object item to the given part. | ||
190 | /// </summary> | ||
191 | /// <remarks> | ||
192 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | ||
193 | /// functions more than once in a test. | ||
194 | /// </remarks> | ||
195 | /// | ||
196 | /// <param name="assetService"></param> | ||
197 | /// <param name="sop"></param> | ||
198 | /// <param name="itemName"></param> | ||
199 | /// <param name="id"></param> | ||
200 | /// <param name="userId"></param> | ||
201 | public static TaskInventoryItem AddSceneObject( | ||
202 | IAssetService assetService, SceneObjectPart sop, string itemName, UUID itemId, UUID userId) | ||
203 | { | ||
204 | SceneObjectGroup taskSceneObject = SceneHelpers.CreateSceneObject(1, userId); | ||
205 | |||
206 | return TaskInventoryHelpers.AddSceneObject( | ||
207 | assetService, sop, itemName, itemId, taskSceneObject, TestHelpers.ParseTail(0x10)); | ||
208 | } | ||
188 | } | 209 | } |
189 | } \ No newline at end of file | 210 | } \ No newline at end of file |