diff options
Diffstat (limited to '')
3 files changed, 42 insertions, 64 deletions
diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index d51107d..5fd5ab5 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs | |||
@@ -76,9 +76,7 @@ namespace OpenSim.Framework.Serialization.External | |||
76 | reader.ReadStartElement("InvType"); | 76 | reader.ReadStartElement("InvType"); |
77 | item.InvType = Convert.ToInt32(reader.ReadString()); | 77 | item.InvType = Convert.ToInt32(reader.ReadString()); |
78 | reader.ReadEndElement(); | 78 | reader.ReadEndElement(); |
79 | reader.ReadStartElement("CreatorUUID"); | 79 | item.CreatorId = reader.ReadElementString("CreatorUUID"); |
80 | item.CreatorId = reader.ReadString(); | ||
81 | reader.ReadEndElement(); | ||
82 | reader.ReadStartElement("CreationDate"); | 80 | reader.ReadStartElement("CreationDate"); |
83 | item.CreationDate = Convert.ToInt32(reader.ReadString()); | 81 | item.CreationDate = Convert.ToInt32(reader.ReadString()); |
84 | reader.ReadEndElement(); | 82 | reader.ReadEndElement(); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index e471160..5388403 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -35,17 +35,18 @@ using OpenMetaverse; | |||
35 | using OpenSim.Data; | 35 | using OpenSim.Data; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Serialization; | 37 | using OpenSim.Framework.Serialization; |
38 | using OpenSim.Framework.Serialization.External; | ||
38 | using OpenSim.Framework.Communications; | 39 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; | 41 | using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; |
41 | using OpenSim.Region.CoreModules.World.Archiver; | 42 | using OpenSim.Region.CoreModules.World.Serialiser; |
42 | using OpenSim.Region.Framework.Scenes; | 43 | using OpenSim.Region.Framework.Scenes; |
43 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
44 | using OpenSim.Tests.Common.Setup; | 45 | using OpenSim.Tests.Common.Setup; |
45 | 46 | ||
46 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
47 | { | 48 | { |
48 | [TestFixture, LongRunning] | 49 | [TestFixture] |
49 | public class InventoryArchiverTests | 50 | public class InventoryArchiverTests |
50 | { | 51 | { |
51 | private void SaveCompleted( | 52 | private void SaveCompleted( |
@@ -189,72 +190,57 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
189 | // TODO: Test presence of more files and contents of files. | 190 | // TODO: Test presence of more files and contents of files. |
190 | } | 191 | } |
191 | 192 | ||
192 | /* | ||
193 | /// <summary> | 193 | /// <summary> |
194 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). | 194 | /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). |
195 | /// </summary> | 195 | /// </summary> |
196 | [Test] | 196 | [Test] |
197 | public void TestLoadIarV0p1() | 197 | public void TestLoadIarV0p1() |
198 | { | 198 | { |
199 | //log4net.Config.XmlConfigurator.Configure(); | 199 | Console.WriteLine("Started TestLoadIarV0p1()"); |
200 | |||
201 | log4net.Config.XmlConfigurator.Configure(); | ||
202 | |||
203 | string userFirstName = "Mr"; | ||
204 | string userLastName = "Tiddles"; | ||
205 | string folderName = "a"; | ||
206 | string archiveFolderName | ||
207 | = string.Format("{0}{1}{2}", folderName, ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, UUID.Random()); | ||
208 | string itemName = "b.lsl"; | ||
209 | string archiveItemName | ||
210 | = string.Format("{0}{1}{2}", itemName, "_", UUID.Random()); | ||
200 | 211 | ||
201 | MemoryStream archiveWriteStream = new MemoryStream(); | 212 | MemoryStream archiveWriteStream = new MemoryStream(); |
202 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); | 213 | TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); |
203 | 214 | ||
204 | string item1FileName = string.Format("{0}{1}/{2}", INVENTORY_PATH, "a", "b.lsl"); | 215 | InventoryItemBase item1 = new InventoryItemBase(); |
205 | tar.WriteFile(item1FileName, item1. | 216 | item1.Name = itemName; |
206 | 217 | item1.AssetID = UUID.Random(); | |
207 | string part1Name = "object1"; | 218 | item1.GroupID = UUID.Random(); |
208 | PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); | 219 | |
209 | Vector3 groupPosition = new Vector3(90, 80, 70); | 220 | string item1FileName |
210 | Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); | 221 | = string.Format("{0}{1}/{2}", ArchiveConstants.INVENTORY_PATH, archiveFolderName, archiveItemName); |
211 | Vector3 offsetPosition = new Vector3(20, 25, 30); | 222 | tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); |
223 | tar.Close(); | ||
212 | 224 | ||
225 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
226 | |||
213 | SerialiserModule serialiserModule = new SerialiserModule(); | 227 | SerialiserModule serialiserModule = new SerialiserModule(); |
214 | ArchiverModule archiverModule = new ArchiverModule(); | 228 | InventoryArchiverModule archiverModule = new InventoryArchiverModule(); |
215 | 229 | ||
230 | // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene | ||
216 | Scene scene = SceneSetupHelpers.SetupScene(); | 231 | Scene scene = SceneSetupHelpers.SetupScene(); |
217 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 232 | SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
218 | 233 | scene.CommsManager.UserAdminService.AddUser(userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000); | |
219 | SceneObjectPart part1 | 234 | archiverModule.DearchiveInventory(userFirstName, userLastName, "/", archiveReadStream); |
220 | = new SceneObjectPart( | 235 | |
221 | UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); | 236 | CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName); |
222 | part1.Name = part1Name; | 237 | InventoryFolderImpl foundFolder = userInfo.RootFolder.FindFolderByPath(folderName); |
223 | SceneObjectGroup object1 = new SceneObjectGroup(part1); | 238 | Assert.That(foundFolder, Is.Not.Null, string.Format("Folder {0} not found on load", folderName)); |
224 | scene.AddNewSceneObject(object1, false); | 239 | |
225 | 240 | InventoryItemBase foundItem = foundFolder.FindItemByPath(itemName); | |
226 | string object1FileName = string.Format( | 241 | Assert.That(foundItem, Is.Not.Null, string.Format("Item {0} not found on load", itemName)); |
227 | "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", | 242 | |
228 | part1Name, | 243 | Console.WriteLine("Finished TestLoadIarV0p1()"); |
229 | Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), | ||
230 | part1.UUID); | ||
231 | tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, object1.ToXmlString2()); | ||
232 | |||
233 | tar.Close(); | ||
234 | |||
235 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | ||
236 | |||
237 | // SerialiserModule serialiserModule = new SerialiserModule(); | ||
238 | // ArchiverModule archiverModule = new ArchiverModule(); | ||
239 | |||
240 | // Scene scene = SceneSetupHelpers.SetupScene(); | ||
241 | // SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
242 | |||
243 | archiverModule.DearchiveRegion(archiveReadStream); | ||
244 | |||
245 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); | ||
246 | |||
247 | Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); | ||
248 | Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); | ||
249 | Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); | ||
250 | Assert.That( | ||
251 | object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); | ||
252 | Assert.That( | ||
253 | object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); | ||
254 | |||
255 | // Temporary | ||
256 | Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); | ||
257 | } | 244 | } |
258 | */ | ||
259 | } | 245 | } |
260 | } | 246 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 323d62b..e75ca20 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs | |||
@@ -225,12 +225,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests | |||
225 | 225 | ||
226 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 226 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
227 | 227 | ||
228 | // SerialiserModule serialiserModule = new SerialiserModule(); | ||
229 | // ArchiverModule archiverModule = new ArchiverModule(); | ||
230 | |||
231 | // Scene scene = SceneSetupHelpers.SetupScene(); | ||
232 | // SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | ||
233 | |||
234 | archiverModule.DearchiveRegion(archiveReadStream); | 228 | archiverModule.DearchiveRegion(archiveReadStream); |
235 | 229 | ||
236 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); | 230 | SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); |