aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs91
1 files changed, 67 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index dd27294..937c414 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -33,7 +33,6 @@ using OpenSim.Framework;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common; 35using OpenSim.Tests.Common;
36using OpenSim.Tests.Common.Mock;
37 36
38namespace OpenSim.Region.Framework.Scenes.Tests 37namespace OpenSim.Region.Framework.Scenes.Tests
39{ 38{
@@ -62,11 +61,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
62 = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero); 61 = AssetHelpers.CreateAsset(corruptAssetUuid, AssetType.Notecard, "CORRUPT ASSET", UUID.Zero);
63 m_assetService.Store(corruptAsset); 62 m_assetService.Store(corruptAsset);
64 63
65 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); 64 m_uuidGatherer.AddForInspection(corruptAssetUuid);
66 m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); 65 m_uuidGatherer.GatherAll();
67 66
68 // 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.
69 Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); 68 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(1));
70 } 69 }
71 70
72 /// <summary> 71 /// <summary>
@@ -78,38 +77,82 @@ namespace OpenSim.Region.Framework.Scenes.Tests
78 TestHelpers.InMethod(); 77 TestHelpers.InMethod();
79 78
80 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); 79 UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
81 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
82
83 m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
84 80
85 // We count the uuid as gathered even if the asset itself is missing. 81 m_uuidGatherer.AddForInspection(missingAssetUuid);
86 Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); 82 m_uuidGatherer.GatherAll();
83
84 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(0));
87 } 85 }
88 86
89 [Test] 87 [Test]
90 public void TestNotecardAsset() 88 public void TestNotecardAsset()
91 { 89 {
92 TestHelpers.InMethod(); 90 TestHelpers.InMethod();
93// log4net.Config.XmlConfigurator.Configure(); 91// TestHelpers.EnableLogging();
94 92
95 UUID ownerId = TestHelpers.ParseTail(0x10); 93 UUID ownerId = TestHelpers.ParseTail(0x10);
96 UUID soAssetId = TestHelpers.ParseTail(0x20); 94 UUID embeddedId = TestHelpers.ParseTail(0x20);
95 UUID secondLevelEmbeddedId = TestHelpers.ParseTail(0x21);
96 UUID missingEmbeddedId = TestHelpers.ParseTail(0x22);
97 UUID ncAssetId = TestHelpers.ParseTail(0x30); 97 UUID ncAssetId = TestHelpers.ParseTail(0x30);
98 98
99 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, ownerId); 99 AssetBase ncAsset
100 AssetBase soAsset = AssetHelpers.CreateAsset(soAssetId, so); 100 = AssetHelpers.CreateNotecardAsset(
101 m_assetService.Store(soAsset); 101 ncAssetId, string.Format("Hello{0}World{1}", embeddedId, missingEmbeddedId));
102
103 AssetBase ncAsset = AssetHelpers.CreateNotecardAsset(ncAssetId, soAssetId.ToString());
104 m_assetService.Store(ncAsset); 102 m_assetService.Store(ncAsset);
105 103
106 IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>(); 104 AssetBase embeddedAsset
107 m_uuidGatherer.GatherAssetUuids(ncAssetId, AssetType.Notecard, foundAssetUuids); 105 = AssetHelpers.CreateNotecardAsset(embeddedId, string.Format("{0} We'll meet again.", secondLevelEmbeddedId));
106 m_assetService.Store(embeddedAsset);
108 107
109 // We count the uuid as gathered even if the asset itself is corrupt. 108 AssetBase secondLevelEmbeddedAsset
110 Assert.That(foundAssetUuids.Count, Is.EqualTo(2)); 109 = AssetHelpers.CreateNotecardAsset(secondLevelEmbeddedId, "Don't know where, don't know when.");
111 Assert.That(foundAssetUuids.ContainsKey(ncAssetId)); 110 m_assetService.Store(secondLevelEmbeddedAsset);
112 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));
122 }
123
124 [Test]
125 public void TestTaskItems()
126 {
127 TestHelpers.InMethod();
128// TestHelpers.EnableLogging();
129
130 UUID ownerId = TestHelpers.ParseTail(0x10);
131
132 SceneObjectGroup soL0 = SceneHelpers.CreateSceneObject(1, ownerId, "l0", 0x20);
133 SceneObjectGroup soL1 = SceneHelpers.CreateSceneObject(1, ownerId, "l1", 0x21);
134 SceneObjectGroup soL2 = SceneHelpers.CreateSceneObject(1, ownerId, "l2", 0x22);
135
136 TaskInventoryHelpers.AddScript(
137 m_assetService, soL2.RootPart, TestHelpers.ParseTail(0x33), TestHelpers.ParseTail(0x43), "l3-script", "gibberish");
138
139 TaskInventoryHelpers.AddSceneObject(
140 m_assetService, soL1.RootPart, "l2-item", TestHelpers.ParseTail(0x32), soL2, TestHelpers.ParseTail(0x42));
141 TaskInventoryHelpers.AddSceneObject(
142 m_assetService, soL0.RootPart, "l1-item", TestHelpers.ParseTail(0x31), soL1, TestHelpers.ParseTail(0x41));
143
144 m_uuidGatherer.AddForInspection(soL0);
145 m_uuidGatherer.GatherAll();
146
147// foreach (UUID key in m_uuidGatherer.GatheredUuids.Keys)
148// System.Console.WriteLine("key : {0}", key);
149
150 // We expect to see the default prim texture and the assets of the contained task items
151 Assert.That(m_uuidGatherer.GatheredUuids.Count, Is.EqualTo(4));
152 Assert.That(m_uuidGatherer.GatheredUuids.ContainsKey(new UUID(Constants.DefaultTexture)));
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)));
113 } 156 }
114 } 157 }
115} 158} \ No newline at end of file