Make the IteratingUuidGatherer the only UuidGatherer.

This UUID gatherer provides a superset of the previous gatherer's functionality
as it also allows the caller to control gathering iterations for load purposes.
This commit is contained in:
Justin Clark-Casey (justincc)
2015-01-08 20:21:40 +00:00
parent 9dc4b2c479
commit 08606ae409
8 changed files with 112 additions and 713 deletions

View File

@@ -61,11 +61,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
= AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero);
m_assetService.Store(corruptAsset);
IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>();
m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, (sbyte)AssetType.Object, foundAssetUuids);
m_uuidGatherer.AddForInspection(corruptAssetUuid);
m_uuidGatherer.GatherAll();
// We count the uuid as gathered even if the asset itself is corrupt.
Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1));
}
/// <summary>
@@ -77,38 +77,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelpers.InMethod();
UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>();
m_uuidGatherer.GatherAssetUuids(missingAssetUuid, (sbyte)AssetType.Object, foundAssetUuids);
// We count the uuid as gathered even if the asset itself is missing.
Assert.That(foundAssetUuids.Count, Is.EqualTo(1));
m_uuidGatherer.AddForInspection(missingAssetUuid);
m_uuidGatherer.GatherAll();
Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(0));
}
[Test]
public void TestNotecardAsset()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
TestHelpers.EnableLogging();
UUID ownerId = TestHelpers.ParseTail(0x10);
UUID soAssetId = TestHelpers.ParseTail(0x20);
UUID embeddedId = TestHelpers.ParseTail(0x20);
UUID missingEmbeddedId = TestHelpers.ParseTail(0x21);
UUID ncAssetId = TestHelpers.ParseTail(0x30);
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId);
AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so);
m_assetService.Store(soAsset);
AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString());
AssetBase ncAsset
= AssetHelpers.CreateNotecardAsset(
ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId));
m_assetService.Store(ncAsset);
IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>();
m_uuidGatherer.GatherAssetUuids(ncAssetId, (sbyte)AssetType.Notecard, foundAssetUuids);
AssetBase embeddedAsset = AssetHelpers.CreateNotecardAsset(embeddedId, "We'll meet again.");
m_assetService.Store(embeddedAsset);
// We count the uuid as gathered even if the asset itself is corrupt.
Assert.That(foundAssetUuids.Count, Is.EqualTo(2));
Assert.That(foundAssetUuids.ContainsKey(ncAssetId));
Assert.That(foundAssetUuids.ContainsKey(soAssetId));
m_uuidGatherer.AddForInspection(ncAssetId);
m_uuidGatherer.GatherAll();
// 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(missingEmbeddedId));
}
}
}
}