29 using System.Collections.Generic;
31 using System.Reflection;
32 using System.Threading;
33 using NUnit.Framework;
36 using OpenSim.Framework;
37 using OpenSim.Framework.Serialization;
38 using OpenSim.Framework.Serialization.External;
39 using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
40 using OpenSim.Region.CoreModules.World.Serialiser;
41 using OpenSim.Region.Framework.Scenes;
42 using OpenSim.Region.Framework.Scenes.Serialization;
43 using OpenSim.Services.Interfaces;
44 using OpenSim.Tests.Common;
46 namespace OpenSim.
Region.CoreModules.
Avatar.Inventory.Archiver.Tests
63 SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
69 TestHelpers.InMethod();
72 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1,
"password");
73 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName,
"/",
"password", m_iarStream);
76 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName);
78 Assert.That(coaItem, Is.Not.Null,
"Didn't find loaded item 1");
80 string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID);
83 bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa);
85 Assert.That(readResult, Is.True);
86 Assert.That(coa.Count, Is.EqualTo(2));
88 List<SceneObjectGroup> coaObjects = coa.Objects;
89 Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse(
"00000000-0000-0000-0000-000000000120")));
90 Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(
new Vector3(15, 30, 45)));
92 Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse(
"00000000-0000-0000-0000-000000000140")));
93 Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(
new Vector3(25, 50, 75)));
103 TestHelpers.InMethod();
106 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1,
"meowfood");
108 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName,
"/",
"meowfood", m_iarStream);
110 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
113 foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()),
114 "Loaded item non-uuid creator doesn't match original");
116 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID),
117 "Loaded item uuid creator doesn't match original");
118 Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID),
119 "Loaded item owner doesn't match inventory reciever");
121 AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
122 string xmlData = Utils.BytesToString(asset1.Data);
123 SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
125 Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
168 TestHelpers.InMethod();
171 UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT,
"password");
172 m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName,
"/",
"password", m_iarStream);
175 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
177 Assert.That(foundItem1, Is.Not.Null,
"Didn't find loaded item 1");
179 foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
180 "Loaded item non-uuid creator doesn't match that of the loading user");
182 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
183 "Loaded item uuid creator doesn't match that of the loading user");
185 AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
186 string xmlData = Utils.BytesToString(asset1.Data);
187 SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
189 Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
void TestLoadIarCreatorAccountPresent()
Test case where a creator account exists for the creator UUID embedded in item metadata and serialize...
void TestLoadIarV0_1AbsentCreator()
Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) ...
A scene object group is conceptually an object in the scene. The object is constituted of SceneObject...
InventoryArchiverModule m_archiverModule
Asset class. All Assets are reference by this class or a class derived from this class ...
This module loads and saves OpenSimulator inventory archives
Inventory Item - contains all the properties associated with an individual inventory piece...
Helpers for setting up scenes.
void TestLoadCoalesecedItem()
Represents a coalescene of scene objects. A coalescence occurs when objects that are not in the same ...