aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-05-21 19:36:39 +0100
committerJustin Clark-Casey (justincc)2010-05-21 19:36:39 +0100
commit74ef1ed36f234d93aa3d58b1602344bcb3e00d6e (patch)
tree4d2cea7595c5ae54fc8eff50f541b4716660c256 /OpenSim/Region/CoreModules
parentOnly send dialogs and notices to root agents, not child agents (diff)
downloadopensim-SC-74ef1ed36f234d93aa3d58b1602344bcb3e00d6e.zip
opensim-SC-74ef1ed36f234d93aa3d58b1602344bcb3e00d6e.tar.gz
opensim-SC-74ef1ed36f234d93aa3d58b1602344bcb3e00d6e.tar.bz2
opensim-SC-74ef1ed36f234d93aa3d58b1602344bcb3e00d6e.tar.xz
add prim item and test asset save in save oar unit test
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs32
2 files changed, 31 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 4215f97..a1451ce 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
239 239
240 if (asset != null) 240 if (asset != null)
241 { 241 {
242// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as found", id); 242// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
243 m_foundAssetUuids.Add(asset.FullID); 243 m_foundAssetUuids.Add(asset.FullID);
244 m_assetsArchiver.WriteAsset(asset); 244 m_assetsArchiver.WriteAsset(asset);
245 } 245 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 624dc22..f3e5458 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -33,8 +33,8 @@ using log4net.Config;
33using NUnit.Framework; 33using NUnit.Framework;
34using NUnit.Framework.SyntaxHelpers; 34using NUnit.Framework.SyntaxHelpers;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.Assets;
36using OpenSim.Framework; 37using OpenSim.Framework;
37
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 39using OpenSim.Framework.Serialization.External;
40using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
@@ -44,6 +44,9 @@ using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 45using OpenSim.Tests.Common.Mock;
46using OpenSim.Tests.Common.Setup; 46using OpenSim.Tests.Common.Setup;
47using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
48using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
49using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
47 50
48namespace OpenSim.Region.CoreModules.World.Archiver.Tests 51namespace OpenSim.Region.CoreModules.World.Archiver.Tests
49{ 52{
@@ -55,6 +58,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
55 58
56 protected TestScene m_scene; 59 protected TestScene m_scene;
57 protected ArchiverModule m_archiverModule; 60 protected ArchiverModule m_archiverModule;
61
62 protected TaskInventoryItem m_soundItem;
58 63
59 [SetUp] 64 [SetUp]
60 public void SetUp() 65 public void SetUp()
@@ -127,7 +132,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
127 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); 132 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
128 133
129 SceneObjectPart part2 = CreateSceneObjectPart2(); 134 SceneObjectPart part2 = CreateSceneObjectPart2();
130 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); 135
136 AssetNotecard nc = new AssetNotecard("Hello World!");
137 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
138 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
139 AssetBase ncAsset
140 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
141 m_scene.AssetService.Store(ncAsset);
142 SceneObjectGroup sog2 = new SceneObjectGroup(part2);
143 TaskInventoryItem ncItem
144 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
145 part2.Inventory.AddInventoryItem(ncItem, true);
146
147 m_scene.AddNewSceneObject(sog2, false);
131 148
132 MemoryStream archiveWriteStream = new MemoryStream(); 149 MemoryStream archiveWriteStream = new MemoryStream();
133 m_scene.EventManager.OnOarFileSaved += SaveCompleted; 150 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
@@ -151,8 +168,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
151 TarArchiveReader tar = new TarArchiveReader(archiveReadStream); 168 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
152 169
153 bool gotControlFile = false; 170 bool gotControlFile = false;
171 bool gotNcAssetFile = false;
154 bool gotObject1File = false; 172 bool gotObject1File = false;
155 bool gotObject2File = false; 173 bool gotObject2File = false;
174
175 string expectedNcAssetFileName = string.Format("{0}_{1}", ncAssetUuid, "notecard.txt");
156 string expectedObject1FileName = string.Format( 176 string expectedObject1FileName = string.Format(
157 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 177 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
158 part1.Name, 178 part1.Name,
@@ -173,6 +193,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
173 { 193 {
174 gotControlFile = true; 194 gotControlFile = true;
175 } 195 }
196 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
197 {
198 string fileName = filePath.Remove(0, ArchiveConstants.ASSETS_PATH.Length);
199
200 Assert.That(fileName, Is.EqualTo(expectedNcAssetFileName));
201 gotNcAssetFile = true;
202 }
176 else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH)) 203 else if (filePath.StartsWith(ArchiveConstants.OBJECTS_PATH))
177 { 204 {
178 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); 205 string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length);
@@ -191,6 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
191 } 218 }
192 219
193 Assert.That(gotControlFile, Is.True, "No control file in archive"); 220 Assert.That(gotControlFile, Is.True, "No control file in archive");
221 Assert.That(gotNcAssetFile, Is.True, "No notecard asset file in archive");
194 Assert.That(gotObject1File, Is.True, "No object1 file in archive"); 222 Assert.That(gotObject1File, Is.True, "No object1 file in archive");
195 Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 223 Assert.That(gotObject2File, Is.True, "No object2 file in archive");
196 224