diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index a12b170..4ae27d7 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,48 @@ 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 secondLevelEmbeddedId = TestHelpers.ParseTail(0x21); | ||
96 | UUID missingEmbeddedId = TestHelpers.ParseTail(0x22); | ||
96 | UUID ncAssetId = TestHelpers.ParseTail(0x30); | 97 | UUID ncAssetId = TestHelpers.ParseTail(0x30); |
97 | 98 | ||
98 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); | 99 | AssetBase ncAsset |
99 | AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); | 100 | = AssetHelpers.CreateNotecardAsset( |
100 | m_assetService.Store(soAsset); | 101 | ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId)); |
101 | |||
102 | AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString()); | ||
103 | m_assetService.Store(ncAsset); | 102 | m_assetService.Store(ncAsset); |
104 | 103 | ||
105 | IDictionary<UUID, sbyte> foundAssetUuids = new Dictionary<UUID, sbyte>(); | 104 | AssetBase embeddedAsset |
106 | m_uuidGatherer.GatherAssetUuids(ncAssetId, (sbyte)AssetType.Notecard, foundAssetUuids); | 105 | = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId)); |
106 | m_assetService.Store(embeddedAsset); | ||
107 | 107 | ||
108 | // We count the uuid as gathered even if the asset itself is corrupt. | 108 | AssetBase secondLevelEmbeddedAsset |
109 | Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); | 109 | = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when."); |
110 | Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); | 110 | m_assetService.Store(secondLevelEmbeddedAsset); |
111 | Assert.That(foundAssetUuids.ContainsKey(soAssetId)); | 111 | |
112 | m_uuidGatherer.AddForInspection(ncAssetId); | ||
113 | m_uuidGatherer.GatherAll(); | ||
114 | |||
115 | // foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys) | ||
116 | // System.Console.WriteLine("key : {0}", key); | ||
117 | |||
118 | Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(3)); | ||
119 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(ncAssetId)); | ||
120 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(embeddedId)); | ||
121 | Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(secondLevelEmbeddedId)); | ||
112 | } | 122 | } |
113 | } | 123 | } |
114 | } | 124 | } \ No newline at end of file |