diff options
author | Justin Clark-Casey (justincc) | 2015-01-08 20:21:40 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-01-08 20:21:40 +0000 |
commit | 08606ae409b400b6f9b83006ed04826eede8a9c7 (patch) | |
tree | b11e1ebfa99dfda28aa3df22041c6e3d167491ce /OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |
parent | Commented out clear_registry_ because (1) it isn't clearing up anything anymo... (diff) | |
download | opensim-SC-08606ae409b400b6f9b83006ed04826eede8a9c7.zip opensim-SC-08606ae409b400b6f9b83006ed04826eede8a9c7.tar.gz opensim-SC-08606ae409b400b6f9b83006ed04826eede8a9c7.tar.bz2 opensim-SC-08606ae409b400b6f9b83006ed04826eede8a9c7.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index a12b170..1fe0e79 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -61,11 +61,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
61 | = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); | 61 | = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); |
62 | m_assetService.Store(corruptAsset); | 62 | m_assetService.Store(corruptAsset); |
63 | 63 | ||
64 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | 64 | m_uuidGatherer.AddForInspection(corruptAssetUuid); |
65 | m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, (sbyte)AssetType.Object, foundAssetUuids); | 65 | m_uuidGatherer.GatherAll(); |
66 | 66 | ||
67 | // We count the uuid as gathered even if the asset itself is corrupt. | 67 | // We count the uuid as gathered even if the asset itself is corrupt. |
68 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 68 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1)); |
69 | } | 69 | } |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
@@ -77,38 +77,42 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
77 | TestHelpers.InMethod(); | 77 | TestHelpers.InMethod(); |
78 | 78 | ||
79 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | 79 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); |
80 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | ||
81 | |||
82 | m_uuidGatherer.GatherAssetUuids(missingAssetUuid, (sbyte)AssetType.Object, foundAssetUuids); | ||
83 | 80 | ||
84 | // We count the uuid as gathered even if the asset itself is missing. | 81 | m_uuidGatherer.AddForInspection(missingAssetUuid); |
85 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 82 | m_uuidGatherer.GatherAll(); |
83 | |||
84 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(0)); | ||
86 | } | 85 | } |
87 | 86 | ||
88 | [Test] | 87 | [Test] |
89 | public void TestNotecardAsset() | 88 | public void TestNotecardAsset() |
90 | { | 89 | { |
91 | TestHelpers.InMethod(); | 90 | TestHelpers.InMethod(); |
92 | // log4net.Config.XmlConfigurator.Configure(); | 91 | TestHelpers.EnableLogging(); |
93 | 92 | ||
94 | UUID ownerId = TestHelpers.ParseTail(0x10); | 93 | UUID ownerId = TestHelpers.ParseTail(0x10); |
95 | UUID soAssetId = TestHelpers.ParseTail(0x20); | 94 | UUID embeddedId = TestHelpers.ParseTail(0x20); |
95 | UUID missingEmbeddedId = TestHelpers.ParseTail(0x21); | ||
96 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | 96 | UUID ncAssetId = TestHelpers.ParseTail(0x30); |
97 | 97 | ||
98 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); | 98 | AssetBase ncAsset |
99 | AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); | 99 | = AssetHelpers.CreateNotecardAsset( |
100 | m_assetService.Store(soAsset); | 100 | ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); |
101 | |||
102 | AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString()); | ||
103 | m_assetService.Store(ncAsset); | 101 | m_assetService.Store(ncAsset); |
104 | 102 | ||
105 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | 103 | AssetBase embeddedAsset = AssetHelpers.CreateNotecardAsset(embeddedId, "We'll meet again."); |
106 | m_uuidGatherer.GatherAssetUuids(ncAssetId, (sbyte)AssetType.Notecard, foundAssetUuids); | 104 | m_assetService.Store(embeddedAsset); |
107 | 105 | ||
108 | // We count the uuid as gathered even if the asset itself is corrupt. | 106 | m_uuidGatherer.AddForInspection(ncAssetId); |
109 | Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); | 107 | m_uuidGatherer.GatherAll(); |
110 | Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); | 108 | |
111 | Assert.That(foundAssetUuids.ContainsKey(soAssetId)); | 109 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) |
110 | // System.Console.WriteLine("key : {0}", key); | ||
111 | |||
112 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); | ||
113 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); | ||
114 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | ||
115 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(missingEmbeddedId)); | ||
112 | } | 116 | } |
113 | } | 117 | } |
114 | } | 118 | } \ No newline at end of file |