diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index 57b4f80..d0bdc91 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
47 | { | 47 | { |
48 | [TestFixture] | 48 | [TestFixture] |
49 | public class InventoryArchiveLoadTests : InventoryArchiveTestCase | 49 | public class InventoryArchiveLoadTests : InventoryArchiveTestCase |
50 | { | 50 | { |
51 | protected TestScene m_scene; | 51 | protected TestScene m_scene; |
52 | protected InventoryArchiverModule m_archiverModule; | 52 | protected InventoryArchiverModule m_archiverModule; |
53 | 53 | ||
@@ -55,12 +55,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
55 | public override void SetUp() | 55 | public override void SetUp() |
56 | { | 56 | { |
57 | base.SetUp(); | 57 | base.SetUp(); |
58 | 58 | ||
59 | SerialiserModule serialiserModule = new SerialiserModule(); | 59 | SerialiserModule serialiserModule = new SerialiserModule(); |
60 | m_archiverModule = new InventoryArchiverModule(); | 60 | m_archiverModule = new InventoryArchiverModule(); |
61 | 61 | ||
62 | m_scene = new SceneHelpers().SetupScene(); | 62 | m_scene = new SceneHelpers().SetupScene(); |
63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); | 63 | SceneHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule); |
64 | } | 64 | } |
65 | 65 | ||
66 | [Test] | 66 | [Test] |
@@ -68,35 +68,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
68 | { | 68 | { |
69 | TestHelpers.InMethod(); | 69 | TestHelpers.InMethod(); |
70 | // TestHelpers.EnableLogging(); | 70 | // TestHelpers.EnableLogging(); |
71 | 71 | ||
72 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 72 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
73 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 73 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
74 | 74 | ||
75 | InventoryItemBase coaItem | 75 | InventoryItemBase coaItem |
76 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | 76 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); |
77 | 77 | ||
78 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); | 78 | Assert.That(coaItem, Is.Not.Null, "Didn't find loaded item 1"); |
79 | 79 | ||
80 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); | 80 | string assetXml = AssetHelpers.ReadAssetAsString(m_scene.AssetService, coaItem.AssetID); |
81 | 81 | ||
82 | CoalescedSceneObjects coa; | 82 | CoalescedSceneObjects coa; |
83 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); | 83 | bool readResult = CoalescedSceneObjectsSerializer.TryFromXml(assetXml, out coa); |
84 | 84 | ||
85 | Assert.That(readResult, Is.True); | 85 | Assert.That(readResult, Is.True); |
86 | Assert.That(coa.Count, Is.EqualTo(2)); | 86 | Assert.That(coa.Count, Is.EqualTo(2)); |
87 | 87 | ||
88 | List<SceneObjectGroup> coaObjects = coa.Objects; | 88 | List<SceneObjectGroup> coaObjects = coa.Objects; |
89 | Assert.That(coaObjects[0].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000120"))); | 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))); | 90 | Assert.That(coaObjects[0].AbsolutePosition, Is.EqualTo(new Vector3(15, 30, 45))); |
91 | 91 | ||
92 | Assert.That(coaObjects[1].UUID, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000140"))); | 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))); | 93 | Assert.That(coaObjects[1].AbsolutePosition, Is.EqualTo(new Vector3(25, 50, 75))); |
94 | } | 94 | } |
95 | 95 | ||
96 | /// <summary> | 96 | /// <summary> |
97 | /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized | 97 | /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized |
98 | /// objects. | 98 | /// objects. |
99 | /// </summary> | 99 | /// </summary> |
100 | [Test] | 100 | [Test] |
101 | public void TestLoadIarCreatorAccountPresent() | 101 | public void TestLoadIarCreatorAccountPresent() |
102 | { | 102 | { |
@@ -105,26 +105,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
105 | 105 | ||
106 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | 106 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); |
107 | 107 | ||
108 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | 108 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); |
109 | InventoryItemBase foundItem1 | 109 | InventoryItemBase foundItem1 |
110 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); | 110 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); |
111 | 111 | ||
112 | Assert.That( | 112 | Assert.That( |
113 | foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()), | 113 | foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()), |
114 | "Loaded item non-uuid creator doesn't match original"); | 114 | "Loaded item non-uuid creator doesn't match original"); |
115 | Assert.That( | 115 | Assert.That( |
116 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID), | 116 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID), |
117 | "Loaded item uuid creator doesn't match original"); | 117 | "Loaded item uuid creator doesn't match original"); |
118 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID), | 118 | Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID), |
119 | "Loaded item owner doesn't match inventory reciever"); | 119 | "Loaded item owner doesn't match inventory reciever"); |
120 | 120 | ||
121 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 121 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
122 | string xmlData = Utils.BytesToString(asset1.Data); | 122 | string xmlData = Utils.BytesToString(asset1.Data); |
123 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 123 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
124 | 124 | ||
125 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); | 125 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID)); |
126 | } | 126 | } |
127 | 127 | ||
128 | // /// <summary> | 128 | // /// <summary> |
129 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where | 129 | // /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where |
130 | // /// an account exists with the same name as the creator, though not the same id. | 130 | // /// an account exists with the same name as the creator, though not the same id. |
@@ -137,24 +137,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
137 | // | 137 | // |
138 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); | 138 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); |
139 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); | 139 | // UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); |
140 | // | 140 | // |
141 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 141 | // m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
142 | // InventoryItemBase foundItem1 | 142 | // InventoryItemBase foundItem1 |
143 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 143 | // = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
144 | // | 144 | // |
145 | // Assert.That( | 145 | // Assert.That( |
146 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), | 146 | // foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()), |
147 | // "Loaded item non-uuid creator doesn't match original"); | 147 | // "Loaded item non-uuid creator doesn't match original"); |
148 | // Assert.That( | 148 | // Assert.That( |
149 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), | 149 | // foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID), |
150 | // "Loaded item uuid creator doesn't match original"); | 150 | // "Loaded item uuid creator doesn't match original"); |
151 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), | 151 | // Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID), |
152 | // "Loaded item owner doesn't match inventory reciever"); | 152 | // "Loaded item owner doesn't match inventory reciever"); |
153 | // | 153 | // |
154 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 154 | // AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
155 | // string xmlData = Utils.BytesToString(asset1.Data); | 155 | // string xmlData = Utils.BytesToString(asset1.Data); |
156 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 156 | // SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
157 | // | 157 | // |
158 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); | 158 | // Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID)); |
159 | // } | 159 | // } |
160 | 160 | ||
@@ -167,26 +167,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
167 | { | 167 | { |
168 | TestHelpers.InMethod(); | 168 | TestHelpers.InMethod(); |
169 | // log4net.Config.XmlConfigurator.Configure(); | 169 | // log4net.Config.XmlConfigurator.Configure(); |
170 | 170 | ||
171 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); | 171 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); |
172 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | 172 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); |
173 | 173 | ||
174 | InventoryItemBase foundItem1 | 174 | InventoryItemBase foundItem1 |
175 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 175 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
176 | 176 | ||
177 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); | 177 | Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); |
178 | Assert.That( | 178 | Assert.That( |
179 | foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()), | 179 | foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()), |
180 | "Loaded item non-uuid creator doesn't match that of the loading user"); | 180 | "Loaded item non-uuid creator doesn't match that of the loading user"); |
181 | Assert.That( | 181 | Assert.That( |
182 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID), | 182 | foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID), |
183 | "Loaded item uuid creator doesn't match that of the loading user"); | 183 | "Loaded item uuid creator doesn't match that of the loading user"); |
184 | 184 | ||
185 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); | 185 | AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString()); |
186 | string xmlData = Utils.BytesToString(asset1.Data); | 186 | string xmlData = Utils.BytesToString(asset1.Data); |
187 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 187 | SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
188 | 188 | ||
189 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); | 189 | Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID)); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | } \ No newline at end of file | 192 | } \ No newline at end of file |