aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs48
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